I'm playing with an extension to make Pegasus Mail "hard to close" (much like the Mercury/32 option). Graying "Close" on the system menu item is effective against "Close" and the "X" button but it does not thwart <Alt-F4> (no surprise). On the other hand, a WH_GETMESSAGE hook whose guts are
if ( pmsg->hwnd == hWndPMFrame
&& pmsg->message == WM_SYSCOMMAND
&& pmsg->wParam == SC_CLOSE )
{
pmsg->wParam = SC_MINIMIZE;
}
is effectlve against the system menu's "Close" and <Alt-F4> but not against the "X" button. The "X" button does cause <WM_SYSCOMMAND, SC_CLOSE> (as seen with Spy++) but my hook process never sees it. Do you know why my hook process doesn't see the message in this case?
A second question: When not using a hook, and simply graying the system menu's "Close", my (startup) extension unloads itself by sending WM_CLOSE to hParent (from FORMINIT). Is that an acceptable way for an extension to unload itself?
Thanks.
- Vince
<p>I'm playing with an extension to make Pegasus Mail "hard to close" (much like the Mercury/32 option).&nbsp; Graying "Close" on the system menu item is effective against "Close" and the "X" button but it does not thwart &lt;Alt-F4&gt; (no surprise).&nbsp; On the other hand, a WH_GETMESSAGE hook whose guts are</p><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (&nbsp;&nbsp;&nbsp; pmsg-&gt;hwnd == hWndPMFrame
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;&amp; pmsg-&gt;message == WM_SYSCOMMAND
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;&amp; pmsg-&gt;wParam == SC_CLOSE&nbsp; )
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pmsg-&gt;wParam = SC_MINIMIZE;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
</p><p>is effectlve against the system menu's "Close" and &lt;Alt-F4&gt; but not against the "X" button.&nbsp; The "X" button does cause &lt;WM_SYSCOMMAND, SC_CLOSE&gt; (as seen with Spy++) but my hook process never sees it.&nbsp; Do you know why my hook process doesn't see the message in this case?</p><p>A second question:&nbsp; When not using a hook, and simply graying the system menu's "Close", my (startup) extension unloads itself by sending WM_CLOSE to hParent (from FORMINIT).&nbsp; Is that an acceptable way for an extension to unload itself?</p><p>Thanks.</p><p>&nbsp;- Vince&nbsp;</p>