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


Groups > comp.lang.basic.visual.misc > #1043 > unrolled thread

VB6 application in XP Mode, Host computer issues shutdown

Started byGabriel Knight <me@somewhere.com>
First post2012-04-26 10:27 -0400
Last post2012-05-01 09:29 -0700
Articles 9 — 5 participants

Back to article view | Back to comp.lang.basic.visual.misc


Contents

  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

#1043 — VB6 application in XP Mode, Host computer issues shutdown

FromGabriel Knight <me@somewhere.com>
Date2012-04-26 10:27 -0400
SubjectVB6 application in XP Mode, Host computer issues shutdown
Message-ID<agmip7dp05vetgnsnkt671e5kngq1ls5ei@4ax.com>
Greetings,

Not sure if this is something I can resolve in my VB application, or
if it is something that needs to be addressed at the Windows level.

My application runs a dir() query every x minutes. The computer runs
this in XP Mode and it stays running from startup. This application
was made in order to resolve some connectivity problems they were
having with two DOS applications that run in XP Mode.

The problems are resolved by this application, but when the user
issues a shutdown of the Windows 7 host computer, if my application is
still running they get a transparent screen overlay offering them to
force close the application.

If my application is shutdown in advance, everything is fine, but this
would be a nuisance to the users.

Is there a way for me to detect that there is a shutdown requested?
I'm not even sure if this gets passed to the XP Mode guest virtual
computer. This may be something that needs to be handled in more than
one scope; I'm not sure how - or even if - an application running in
XP Mode will receive notification that the host is attempting to
shutdown.

Any advice or reference would be appreciated.



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [next] | [standalone]


#1044

From"Mayayana" <mayayana@invalid.nospam>
Date2012-04-26 10:40 -0400
Message-ID<jnbmfl$n37$1@dont-email.me>
In reply to#1043
The QueryUnload Event? The unloadmode parameter returns
the source of an unload order, which can be from the OS. 

[toc] | [prev] | [next] | [standalone]


#1045

FromGabriel Knight <me@somewhere.com>
Date2012-04-27 05:15 -0400
Message-ID<msokp7d47vir8dr71qg5du31pudbfnn42c@4ax.com>
In reply to#1044
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. 
>

I can give it a try, thanks!

--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#1046

FromGabriel Knight <me@somewhere.com>
Date2012-04-28 04:53 -0400
Message-ID<hsbnp7p81s469rk2elq6n2qdcddu3fb4u7@4ax.com>
In reply to#1044
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.

:(

--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#1056

FromKarl E. Peterson <karl@exmvps.org>
Date2012-04-30 11:58 -0700
Message-ID<jnmnde$44f$1@dont-email.me>
In reply to#1046
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

[toc] | [prev] | [next] | [standalone]


#1057

FromUlrich Korndoerfer <ulrich_wants_nospam@prosource.de>
Date2012-05-01 00:14 +0200
Message-ID<a08h5tF1joU1@mid.individual.net>
In reply to#1056
Karl E. Peterson schrieb:

> ... Second time, I logged off the VM. 
> 
>   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.
> 

Hm, perhaps his users simply close the virtual machine. This would be 
like pulling the plug out of the PC.

-- 
Ulrich Korndoerfer

VB tips, helpers, solutions -> http://www.prosource.de/Downloads/
MS Newsgruppen Alternativen -> http://www.prosource.de/ms-ng-umzug.html

[toc] | [prev] | [next] | [standalone]


#1058

From"David Youngblood" <dwy@flash.net>
Date2012-05-01 02:52 -0500
Message-ID<jno4qb$3c2$1@dont-email.me>
In reply to#1057
"Ulrich Korndoerfer" <ulrich_wants_nospam@prosource.de> wrote in message 
news:a08h5tF1joU1@mid.individual.net...
>
> Karl E. Peterson schrieb:
>
>> ... Second time, I logged off the VM. 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.
>>
>
> Hm, perhaps his users simply close the virtual machine. This would be like 
> pulling the plug out of the PC.

I would assume (from what the OP has said) that the OP wants his app 
(running in a VM) to be notified that windows is closing when the *host* PC 
is shut down *without* logging off of the VM.

David 

[toc] | [prev] | [next] | [standalone]


#1059

FromKarl E. Peterson <karl@exmvps.org>
Date2012-05-01 09:28 -0700
Message-ID<jnp2vi$aon$1@dont-email.me>
In reply to#1058
David Youngblood pretended :
> "Ulrich Korndoerfer" <ulrich_wants_nospam@prosource.de> wrote...
>>
>> Karl E. Peterson schrieb:
>>
>>> ... Second time, I logged off the VM. 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.
>>
>> Hm, perhaps his users simply close the virtual machine. This would be like 
>> pulling the plug out of the PC.

Heh, okay, no way to trap that!  VM or otherwise!

> I would assume (from what the OP has said) that the OP wants his app (running 
> in a VM) to be notified that windows is closing when the *host* PC is shut 
> down *without* logging off of the VM.

Y'know, I have no idea how various VM products would handle that.  I 
would think most would likely put the VM into hibernation, if that were 
enabled, eh?  But, I see by re-reading the OP, that's apparently the 
correct interpretation.

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

[toc] | [prev] | [next] | [standalone]


#1060

FromKarl E. Peterson <karl@exmvps.org>
Date2012-05-01 09:29 -0700
Message-ID<jnp31v$bat$1@dont-email.me>
In reply to#1043
Gabriel Knight wrote on 4/26/2012 :
> Greetings,
>
> Not sure if this is something I can resolve in my VB application, or
> if it is something that needs to be addressed at the Windows level.
>
> My application runs a dir() query every x minutes. The computer runs
> this in XP Mode and it stays running from startup. This application
> was made in order to resolve some connectivity problems they were
> having with two DOS applications that run in XP Mode.
>
> The problems are resolved by this application, but when the user
> issues a shutdown of the Windows 7 host computer, if my application is
> still running they get a transparent screen overlay offering them to
> force close the application.
>
> If my application is shutdown in advance, everything is fine, but this
> would be a nuisance to the users.
>
> Is there a way for me to detect that there is a shutdown requested?
> I'm not even sure if this gets passed to the XP Mode guest virtual
> computer. This may be something that needs to be handled in more than
> one scope; I'm not sure how - or even if - an application running in
> XP Mode will receive notification that the host is attempting to
> shutdown.
>
> Any advice or reference would be appreciated.

What does Windows do with the XPMode VM when the host is shutting down? 
 Does it attempt to hibernate it?  Does it send a shutdown signal?  
Does it simply "pull the plug"?  If we can understand that, there's an 
answer to be found.

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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.basic.visual.misc


csiph-web