🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1609

Windows wierdity (SDK 3.1)

#1609
From: Tom Armistead
Date: Tue, 13 Oct 1992 03:10
66 lines
2757 bytes
A friend of mine asked me to post this.  Any help would be greatly
appreciated!!!

Thanks,
Tom
----
Here is the situation:

I need to ask another application (which I launched via WinExec) if it is 
okay to close it down.  I do this by sending a WM_QUERYENDSESSION message 
to it.  While I am waiting for the return from the other application, the 
other application puts up a modal window (MessageBox) to ask the user if 
it is okay to exit.  

At this point I begin to experience weirdness.  The message box appears 
with the caption bar color indicating it is the active window.  The mouse 
does not appear to work.  It moves around on the screen, but clicks do not 
register on the message box.  In fact, if I run Spy on all windows, it is 
as if the mouse disappears.  Mouse messages no longer register with Spy.  
In addition, keypresses behave badly.  Tabs may close down the message 
box, bring up the task manager, and other bizarre stuff.  

What is happening??  I am pretty much locked into this scenerio; i.e., I 
have to send a message to another app, I have to wait for the return from 
the message, and the other app has to query the user.  Is there anything I 
can do to avoid this weirdness??  Both apps are simple EXEs (i.e., no MDI 
or anything).  The message is sent from a DLL in app 1, but that doesn't 
seem to be the cause of anything...

Code sample:

In DLL (task = app1):

bRetVal = (BOOL)SendMessage (hwnd, WM_QUERYENDSESSION, 0, 0L);


In app2:

LRESULT CALLBACK _export frameWndProc (HWND hwnd, UINT uiMsg, WPARAM 
wParam, LPARAM lParam)
{
  LRESULT lResult = 0;

  switch (uiMsg) {
    case WM_QUERYENDSESSION :
      // It doesn't matter whether hwnd or NULL is passed to the message
      // box...

      if (IDYES == MessageBox (hwnd, "Ok to exit Client Data??", 
                               "Client Data", MB_YESNO | MB_ICONQUESTION))
        return (TRUE);
      else return (FALSE);

    case ...
  }

  ...

  return (lResult);

}   // frameWndProc
-- 
Tom Armistead            | 2918 Dukeswood Dr.     | Garland, Tx.  75040
toma@swsrv1.cirr.com     | ...!egsner!swsrv1!toma | ...!void!swsrv1!toma
toma@swsrv1.LoneStar.org | ============ THIS SPACE FOR RENT ============
Technical Details
Message-ID: <1992Oct13.031006.12955@swsrv1.cirr.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!darwin.sura.net!dtix!mimsy!prometheus!media!irscscm!bogart!aldoe!krm!mic!void!nowhere!toma

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!darwin.sura.net!dtix!mimsy!prometheus!media!irscscm!bogart!aldoe!krm!mic!void!nowhere!toma
From: toma@swsrv1.cirr.com (Tom Armistead)
Newsgroups: comp.os.ms-windows.programmer.misc
Subject: Windows wierdity (SDK 3.1)
Summary: Programming prob???
Message-ID: <1992Oct13.031006.12955@swsrv1.cirr.com>
Date: 13 Oct 92 03:10:06 GMT
Organization: Software Services; Garland, Tx
Lines: 66