0

First I'll explain what exactly I want to do here. I have a dialog box in which I am showing a frame. Using menu from this dialog, I open another Dialog box which shows me macrogrid block information from the first dialog. So to show 2nd dialog box I am using function : DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc); But this transfers the execution of the program to the new dialog box and I can't process further messages in the 1st dialog unless I close the new dialog box.

Can someone please tell me a way to solve this problem??? Is it the same thing as modal vs modeless dialog-boxes??

Someone suggested me to use BackgroundWorker thread for this purpose. But when I tried to research about it, I read at many places that it doesn't work with win32 programming. Instead in some forums I read about using PostMessage function for the same purpose. Can someone help me deciding what would be the best approach to handle this problem? I would really be grateful if someone could explain it in detail.

Thanks a lot.

1 Answer 1

1

No, the BackgroundWorker component is for .NET projects, not for Win32 applications. And it's designed to run non-GUI operations on a background thread. You still should keep all GUI operations limited to a single thread, even in a .NET application.

But like you said, the problem here is that you're creating a modal dialog, which prevents the user from interacting with anything else in your program until that dialog is closed. The DialogBox function always creates a modal dialog.

If you want a modeless dialog, call the CreateDialog function instead. Modeless dialogs do not block execution until they are closed. You can re-use the same dialog template with this function that you did with DialogBox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.