// JP opened flex table

Click to See Complete Forum and Search --> : New dialog


wongjieyi
April 19th, 2007, 11:24 PM
Hi,

I use the following code to open a new dialog box.


DialogBox(hInst, (LPCTSTR) IDD_PressSpaceBar, hWndParent, (DLGPROC) PressSpaceBar);


But according MSDN, DialogBox will

DialogBox does not return control until the specified callback function terminates the modal dialog box by calling the EndDialog function.


So is there a function which i can call that will not take over the control of my main dialog??

The flow of my program is as such,
1) Press button to run a CreateProcess function
2) After 3 seconds, I would want a dialog to pop up [ for this case i use DialogBox function]
3) WaitForSingleObject(piProcInfo.hThread, INFINITE) for the Process to end
4) After the process ends, I would want the dialogbox to close by itself.

Anyone can help me out.

My current code is

CreateProcess(...)
Sleep(3000);
hWndParent = GetDlgItem(NULL, IDD_PressSpaceBar);
DialogBox(hInst, (LPCTSTR) IDD_PressSpaceBar, hWndParent, (DLGPROC) PressSpaceBar);
WaitForSingleObject(piProcInfo.hThread, INFINITE);
DestroyWindow(hWndParent);


But it will not close the IDD_PressSpaceBar dialog box.

Thanks for your help.

ncode
April 23rd, 2007, 02:13 PM
My current code is

CreateProcess(...)
Sleep(3000);
hWndParent = GetDlgItem(NULL, IDD_PressSpaceBar);
DialogBox(hInst, (LPCTSTR) IDD_PressSpaceBar, hWndParent, (DLGPROC) PressSpaceBar);
WaitForSingleObject(piProcInfo.hThread, INFINITE);
DestroyWindow(hWndParent);

But it will not close the IDD_PressSpaceBar dialog box.

You probably should use a "modeless dialog" instead "modal dialog".
This should looks something like this:

CreateDialog(...);
SendMessage(...); //send "quit" message to your dialog from "main" code
DestroyWindow(...); //call this for dialog HWND in dialog proc as reply on "quit" message

//JP added flex table