Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
Hey ho..
Does anyone know how to show a child dialog with a hidden parent (SW_HIDE)?
I've got window HWND parent .. and now:
Code:
HWND child= CreateDialog( GetModuleHandle( 0 ), MAKEINTRESOURCE( IDD_child ), parent, WndProc_child );
ShowWindow( parent, SW_HIDE );
I would like to show my child dialog but when i hide my parent, the child would not appear... is there any other way of doing this... ?
my dialog must be parent's child...
gracias!
b
Re: Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
When you hide the parent, change the child's parent hwnd to a visible hwnd in your app. If all other hwnds are also hidden, use the desktop hwnd or NULL. When the true parent becomes visible, change the child's parent hwnd back to it again.
Re: Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
That is good idea, the only one prob here is that the moment i'd change that child's parent hwnd to some other visible hwnd is exactly the moment i would need the access to my "original" parent the most (by GetParent(child)) because i use the information chosen on dialog to properly display information on parent .. (user select enter some info, click ok, dialog closes and parent is displayed) ....so this isn't solution for me really...
i guess the most effective way here would be only to store my parent's hwnd on child's hwnd by e.g. SetWindowLongPtr .... or anyone has some other idea of showing child of hidden parent?
Re: Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
Quote:
Originally Posted by
berkov
That is good idea, the only one prob here is that the moment i'd change that child's parent hwnd to some other visible hwnd is exactly the moment i would need the access to my "original" parent the most (by GetParent(child)) because i use the information chosen on dialog to properly display information on parent .. (user select enter some info, click ok, dialog closes and parent is displayed) ....so this isn't solution for me really...
Sure it is.
Quote:
Originally Posted by
berkov
i guess the most effective way here would be only to store my parent's hwnd on child's hwnd by e.g. SetWindowLongPtr .... or anyone has some other idea of showing child of hidden parent?
Yep, if you need the parent window in the child, have the child save it off when it gets created. SetWindowLongPtr is a reasonable approach.
Re: Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
Quote:
Originally Posted by
berkov
Does anyone know how to show a child dialog with a hidden parent (SW_HIDE)?
[...]
Short, neat and clear, the answer is: NO WAY.
Have a look at these FAQs:
Both child and owned windows are hidden when the parent or owner is hidden.
Re: Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
Yes, I was thinking owned.
Re: Show Dialog (WS_CHILD) but with hidden (SW_HIDE) parent's window
Gents,
thanks a lot. I was just hoping that there's some trick for this but i guess SetWindowLongPtr is not so bad idea at the end.
thanks again!
SOLVED.