CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    147

    Question SendMessage to Main Thread

    Hi,

    I'm using Win32 API. I'm executing a worker Thread after launching application.
    Code:
     myThread = CreateThread(NULL, 0, SendStr, NULL, 0, &dw);
    Now, from the Thread SendStr, I want to send Message back to Main Thread to execute something and return either TRUE or FALSE. How can I achieve that? Code example will be great. Thanks

    Code:
    DWORD WINAPI SendStr (LPVOID pParam)
    {
          
          if (something is TRUE)
             // Send Message to Main Thread to execute something to check for the  status TRUE or FALSE
    
    }

  2. #2
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: SendMessage to Main Thread

    [ Moved thread ]

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: SendMessage to Main Thread

    Take a look at the following FAQ...

  4. #4
    Join Date
    Mar 2004
    Posts
    147

    Re: SendMessage to Main Thread

    I'm not familiar with MFC.

    Can u show in Win32 format ?

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: SendMessage to Main Thread

    Although the example in the FAQ is a MFC application...the sending of the message is done using the API....

    What is the purpose of your message? Updating GUI?

  6. #6
    Join Date
    Feb 2002
    Posts
    5,757

    Re: SendMessage to Main 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