CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2012
    Posts
    8

    Is it possible to use BackgroundWorker Thread for Win32 projects????

    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.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Is it possible to use BackgroundWorker Thread for Win32 projects????

    Generally you'll want to keep all the UI components running in a main thread. To solve your problem, can you make the second dialog modeless rather than modal then send a message to the main dialog?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured