Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1056

Re: VB6 application in XP Mode, Host computer issues shutdown

From Karl E. Peterson <karl@exmvps.org>
Newsgroups comp.lang.basic.visual.misc
Subject Re: VB6 application in XP Mode, Host computer issues shutdown
Date 2012-04-30 11:58 -0700
Organization exMVPs.org
Message-ID <jnmnde$44f$1@dont-email.me> (permalink)
References <agmip7dp05vetgnsnkt671e5kngq1ls5ei@4ax.com> <jnbmfl$n37$1@dont-email.me> <hsbnp7p81s469rk2elq6n2qdcddu3fb4u7@4ax.com>

Show all headers | View raw


Gabriel Knight expressed precisely :
> On Thu, 26 Apr 2012 10:40:18 -0400, "Mayayana"
> <mayayana@invalid.nospam> wrote:
>
>> The QueryUnload Event? The unloadmode parameter returns
>> the source of an unload order, which can be from the OS. 
>> 
>
> This didn't work. I already had some code in the QueryUnload event to
> test what triggered the unload. Because I have no min or max button on
> my form, only the X, which actually just minimizes to the systray.
> I put an event condition for Windows Shutdown which ended the
> application (would not be necessary anyway since the test would let it
> close), but anyway this didn't work.
>
> Evidently, XP Mode virtual machine doesn't receive the shutdown
> message from the host computer.
>
>  :(

Time to "show us the code", I think.  You're over-riding the Unload to 
minimize to the tray.  How?

I just put this code in a form that lacked min/max buttons:

   Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As 
Integer)
      Open "C:\QueryUnload.txt" For Append As #1
      Print #1, Now, UnloadMode; " - ";
      Select Case UnloadMode
         Case vbFormControlMenu
            Print #1, "vbFormControlMenu"
         Case vbFormCode
            Print #1, "vbFormCode"
         Case vbAppWindows
            Print #1, "vbAppWindows"
         Case vbFormOwner
            Print #1, "vbFormOwner"
      End Select
      Close #1
   End Sub

Compiled it, copied it to an XP VM, and ran it twice.  First time, I 
closed the form with the [x] button.  Second time, I logged off the VM. 
 Here's the output file:

   4/30/2012 11:56:03 AM        0  - vbFormControlMenu
   4/30/2012 11:56:18 AM        2  - vbAppWindows

Clearly, Windows is sending the shutdown message.

-- 
.NET: It's About Trust!
http://vfred.mvps.org

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

VB6 application in XP Mode, Host computer issues shutdown Gabriel Knight <me@somewhere.com> - 2012-04-26 10:27 -0400
  Re: VB6 application in XP Mode, Host computer issues shutdown "Mayayana" <mayayana@invalid.nospam> - 2012-04-26 10:40 -0400
    Re: VB6 application in XP Mode, Host computer issues shutdown Gabriel Knight <me@somewhere.com> - 2012-04-27 05:15 -0400
    Re: VB6 application in XP Mode, Host computer issues shutdown Gabriel Knight <me@somewhere.com> - 2012-04-28 04:53 -0400
      Re: VB6 application in XP Mode, Host computer issues shutdown Karl E. Peterson <karl@exmvps.org> - 2012-04-30 11:58 -0700
        Re: VB6 application in XP Mode, Host computer issues shutdown Ulrich Korndoerfer <ulrich_wants_nospam@prosource.de> - 2012-05-01 00:14 +0200
          Re: VB6 application in XP Mode, Host computer issues shutdown "David Youngblood" <dwy@flash.net> - 2012-05-01 02:52 -0500
            Re: VB6 application in XP Mode, Host computer issues shutdown Karl E. Peterson <karl@exmvps.org> - 2012-05-01 09:28 -0700
  Re: VB6 application in XP Mode, Host computer issues shutdown Karl E. Peterson <karl@exmvps.org> - 2012-05-01 09:29 -0700

csiph-web