Community Discussions and Support
Extension questions for DH

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 

&lt;p&gt;I&#039;m playing with an extension to make Pegasus Mail &quot;hard to close&quot; (much like the Mercury/32 option).&amp;nbsp; Graying &quot;Close&quot; on the system menu item is effective against &quot;Close&quot; and the &quot;X&quot; button but it does not thwart &amp;lt;Alt-F4&amp;gt; (no surprise).&amp;nbsp; On the other hand, a WH_GETMESSAGE hook whose guts are&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (&amp;nbsp;&amp;nbsp;&amp;nbsp; pmsg-&amp;gt;hwnd == hWndPMFrame &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp; pmsg-&amp;gt;message == WM_SYSCOMMAND &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp; pmsg-&amp;gt;wParam == SC_CLOSE&amp;nbsp; ) &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; pmsg-&amp;gt;wParam = SC_MINIMIZE; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/p&gt;&lt;p&gt;is effectlve against the system menu&#039;s &quot;Close&quot; and &amp;lt;Alt-F4&amp;gt; but not against the &quot;X&quot; button.&amp;nbsp; The &quot;X&quot; button does cause &amp;lt;WM_SYSCOMMAND, SC_CLOSE&amp;gt; (as seen with Spy++) but my hook process never sees it.&amp;nbsp; Do you know why my hook process doesn&#039;t see the message in this case?&lt;/p&gt;&lt;p&gt;A second question:&amp;nbsp; When not using a hook, and simply graying the system menu&#039;s &quot;Close&quot;, my (startup) extension unloads itself by sending WM_CLOSE to hParent (from FORMINIT).&amp;nbsp; Is that an acceptable way for an extension to unload itself?&lt;/p&gt;&lt;p&gt;Thanks.&lt;/p&gt;&lt;p&gt;&amp;nbsp;- Vince&amp;nbsp;&lt;/p&gt;
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft