visual studio 2010 - Creating a separate window against each click on push button -


i working on windows gui application.there 20 push buttons on window. against each button click, want open new window displaying information. can can display information since new , didn’t want try complicated, decided go idea of creating pop window against each button click.

now problem facing since there 20 different windows, need create 20 different window callback functions? though there 1 control in pop window i.e. close sign, need have callback function.

i had been trying idea looks senseless. there other option in can achieve desired functionality?

waiting help.

if of windows should behave same way, can create single window procedure (what you're calling callback function) shared of pop-up windows.

window procedures not have unique individual windows, if multiple windows share same window procedure, react identically messages receive.

for example:

// message procedure pop-up windows. lresult callback mypopupwndproc(hwnd hwnd, uint msg, wparam wparam, lparam lparam) {      switch (msg)     {          // handle messages want here in order         //   customize behavior of pop-up window     }      return defwindowproc(hwnd, msg, wparam, lparam); } 

you specify pointer mypopupwndproc function when register window class pop-up windows (using registerclassex function), , pass name of registered window class when call createwindowex create/display pop-up window whenever 1 of buttons on main window clicked.

of course, if you're wanting simple testing purposes, remember can call messagebox function! no window procedures or class registration required.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -