.NET Form and Message Loop

E

Eric Robert

Hi,

I am using C# code to create a window, get its HWND and pass it to an
unmanaged C++ DLL. This DLL has the code to process messages. My problem is
that I don't receive the WM_QUIT event so, my application never quits. If I
replace the WNDPROC with mine using a call to SetWindowLongPtr, and just
check for messages before passing them to the original WNDPROC, I don't even
get a WM_DESTROY message.

Any idea why this is happening? Any idea how to fix this?

Eric Robert
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Hi Eric,

WM_QUIT is not sent to any window ever. It just causes GetMessage to return
0, which ends the message loop.

As far as WM_DESTROY is concerned my tests show that windows procedures
receive that message. For testing I used Spy++.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top