Click to See Complete Forum and Search --> : Problem with creating visible windows with CreateDialog


blagrang
April 14th, 2003, 10:51 AM
Hello
I need some help.

I have a main window which must create at some right-click event a small popup window :

hRclk = CreateDialog(hInstance,MAKEINTRESOURCE(IDD_RCLK_DIALOG2),hwnd,(DLGPROC) rclkDlgProc);

this works correctly.
Inside this window I want two create another small child window using CreateDialog :

BOOL CALLBACK rclkDlgProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
HWND OpenButton, ViewButton;
OpenButton = CreateDialog(hInstance,MAKEINTRESOURCE(IDD_OpenFile_DIALOG),hRclk,(DLGPROC) OpenFileDlgProc);
);
}
return FALSE;
}


Here is the problem : this window does not appear inside the parent window.

Would anyone knows why and explains me the reasons.

Thank you very much in advance.

Benoit

rxbagain
April 21st, 2003, 01:23 AM
DialogBoxes do not recieve the WM_CREATE message, so the creation of new child dialog is not really executed. You must change WM_CREATE to [B}WM_INITDIALOG[/B].

Hope this will help you.

blagrang
April 30th, 2003, 04:38 AM
Thank you so much for your answer.

first sorry to reply so late but I was away for a while.

Then, thank you for you help. It helps a bit. I mean you were right, the dialog box did not receive the message. Now it receives WM_INITDIALOG correctly, the function CreateDialog return a handler HWND into OpenButton but it still does not appear on the screen.

Do I have to send a WM_PAINT message ? Normally not because WM_INITDIALOG is sent before painting on the screen.

Any idea ?

rxbagain
April 30th, 2003, 04:52 AM
Use ShowWindow

blagrang
April 30th, 2003, 09:57 AM
Thank you so much for your help, rxbagain.
Now it works perfectly