Blocking WM_QUIT

Quick question.

I have an app that use a native DLL through PInvoke, this DLL may call a PostQuitMessage().

How can I avoid it? (as my app should not close)

I tried AddMessageFilter, but it doesn't trigger the WM_QUIT.


Yup, IMessageFilter cannot work. WM_QUIT makes the GetMessage() function return FALSE. It never gets around to calling the message filter, the message loop immediately exits. Overriding WndProc() or canceling OnFormClosing() won't work either. The only workaround I can think of is Detours to disable PostQuitMessage(). That requires some C/C++ skillz.

PostQuitMessage() will have no effect if you call from a thread that doesn't own any windows.

Need Your Help

Why is bracket access notation working but not dot?

sql-server coldfusion struct notation

I have a search form in ColdFusion. On post, it invokes a SQL stored procedure. It returns the first 20 matching records by default, and accepts a "pagenum" parameter (in addition to many other input

Why lookup in SortedDictionary<> is SLOWER than lookup in Dictionary<>?

.net algorithm

As as human I always thought that lookup in something sorted is the way faster than lookup in not sorted.