|
-
July 24th, 2010, 06:58 AM
#1
Closing childwindow close also mainwindow
Hi all!
I have created a Mainwindow with a lot of childwindows in it. The quantity of ChildNow is dynamic cause i want to close or add Childwindwos during the Runtime. Every Childwindow has no titelbar but it has a little button to close the childwindow. Now my problem is that if i close one of the existing Childwindws then the Mainwindow is also closing. How can i avoid it? Here a quick description how my code works:
Code:
HWND *Childwin = new HWND(100); // dynamic array for the children
HWND mainhwnd; // mainwindow
Winmain (...)
{
...
// create mainwindow
mainhwnd = ....
// create some childs
for(i=0;i<10;i++)
{
Childwin[i] = ....
}
...
}
Callback(...)
{
...
WM_COMMAND
...
default
if a certain quit-Childbutton is pressed
DestroyWindow(Child[i]);
WM_DESTROY
PostQuitMessage(0);
WM_PAINT
BitBlt...
draw Child and Main...
WM_TIMER
...
...
}
I guess always if i want to close a childwindow a WM_COMMAND message is generated but also a WM_DESTROY message what also close the mainwindow, but how can i avoid this or anybody has a better concept to close childwindows inside mainwindow?
My second question is that i want add childwindows during the runtime. On a certain event on my desktop a new childwindow should created and appear in the mainwindow as the other childrens. Does anybody has a starting clue how i can realize?
Many thanks in advance, best regards rommi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|