This is the structure of my program with the parent-child relations


Main Window
|
-------> Child Window 1
| |
| ----->Modeless dialog box 1
| |
| ----->Modeless dialog box 2
| |
| ----->Modeless dialog box 3
|
-------> Child Window 2
|
----->Treeview
|
----->Modeless dialog box 4
|
----->Modeless dialog box 5


To send messages to my dialog boxes I have to put IsWindow and IsDialogMessage in my main loop.
But with 5 dialog boxes I have 10 call to funcitions!!!. And if I want to increase the number of dialog boxes I have to increase the number of these calls.

Since dialog 1,2,3 have a diffenrent parent that dialog 4,5, can I move IsWindow and IsDialogMessage to another place?
Are there other solutions?
Posted on 2004-01-05 06:35:23 by greenant
I can't say I fully understood what the problem is, but if I got it right you're calling IsWindow and IsDialogMessage once for every window you create. It should be much simpler to have an array where you store all of your dialog box handles, then every time you get a message just see if it's handle is in the array. If it is, call IsDialogMessage. If not, handle it normally.
Hope that helps :)
Posted on 2004-01-05 17:50:35 by QvasiModo
Because the message hwnd processed by IsDialogMessage is the dialog hwnd (and not the parent hwnd), it must be handled near where the message is retrieved (by GetMessage).

You can put the dialog handles in a search table. You would add a handle for each dialog box you opened, and you would delete a handle for each dialog box you closed.
Posted on 2004-01-05 17:50:58 by tenkey
I will use an array and check the array in the main loop.
Thanks
Posted on 2004-01-06 03:58:14 by greenant