Hidden Window in Unmanaged DLL not receiving messages. 
Author Message
 Hidden Window in Unmanaged DLL not receiving messages.

It appears to me that my single threaded vc++ managed code, while
sitting in a tight while loop blocks an unmanaged DLL's hidden window's
message loop from either handling messages on the queue or it prevents
the messages from queuing.  Here is some psuedo--

{Managed Main}
   Load Unmanaged DLL-
        {Unmanaged DLL execution}
        hwnd = CreateWindow
        SendMessage(hwnd,MyMessage..) - Works flawlessly.
        PostMessage(hwnd,MySecondMessage..)  //  Queue this please?
        return;
   {TightLoop}
   While(true)
     Do some stuff.
     Sleep(1000)
   end while

    My c++ app does not have a message loop of it's own.  This is a
testing wrapper I am writing using a Unit testing tool I developed.  I
cannot seem to use System::Windows::Forms::Application::DoEvents, I get
compile errors.  I thought this would be the simple solution.

Can anyone either confirm or confirm and have an idea for a solution?

Thanks in advanced!

Erik



Sat, 05 Feb 2005 07:59:38 GMT  
 Hidden Window in Unmanaged DLL not receiving messages.
This is normal behavior. If you want to dispatch message, a thread
associated with the window needs to dispatch messages.

The solution is to have a thread that dispatches messages. This has been the
same for unmanaged code as well. The only exception I know of is some of the
magic COM might have done when it creates a default STA for your
application.

Ronald Laeremans
Visual C++ compiler and libraries team


Quote:

> It appears to me that my single threaded vc++ managed code, while
> sitting in a tight while loop blocks an unmanaged DLL's hidden window's
> message loop from either handling messages on the queue or it prevents
> the messages from queuing.  Here is some psuedo--

> {Managed Main}
>    Load Unmanaged DLL-
>        {Unmanaged DLL execution}
> hwnd = CreateWindow
> SendMessage(hwnd,MyMessage..) - Works flawlessly.
> PostMessage(hwnd,MySecondMessage..)  //  Queue this please?
> return;
>    {TightLoop}
>    While(true)
>      Do some stuff.
>      Sleep(1000)
>    end while

>     My c++ app does not have a message loop of it's own.  This is a
> testing wrapper I am writing using a Unit testing tool I developed.  I
> cannot seem to use System::Windows::Forms::Application::DoEvents, I get
> compile errors.  I thought this would be the simple solution.

> Can anyone either confirm or confirm and have an idea for a solution?

> Thanks in advanced!

> Erik



Sun, 27 Feb 2005 23:40:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ATL Window not receiving message post?...

2. CAppBar window receives messages from destroyed window

3. CWindowImpl not receiving messages

4. Not receiving On...Click() messages in ATL Composite Control

5. Not receiving system messages in CDialog derived app

6. Not receiving ListView HDN_BEGINTRACK messages???

7. msnews not receiving lots of messages

8. Not receiving thread messages...

9. Dynamically created controls does not receive messages

10. control not receiving messages

11. Not receiving system messages in CDialog derived app

12. CListCtrl not receiving the HDN_TRACK message

 

 
Powered by phpBB® Forum Software