|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem on shutdown computer if my appication is openedI wrote two application for my company,
but I found that, if anyone of application is opened, the user cannot shutdown the computer. the behaviour is that: if one of application is opened, and then click the shutdown, my application will be terminate but the computer didn't shotdown. afterward, if I click the shutdown again, since my application is already terminated, so the computer can shutdown this time. What the problem is??
Show quote
Hide quote
"Cylix" <cylix2***@gmail.com> wrote in message I had this happen when; in my application I was aborting the form close news:1178246819.692740.185360@q75g2000hsh.googlegroups.com... >I wrote two application for my company, > but I found that, if anyone of application is opened, the user cannot > shutdown the computer. > > the behaviour is that: > if one of application is opened, and then click the shutdown, my > application will be terminate but the computer didn't shotdown. > afterward, if I click the shutdown again, since my application is > already terminated, so the computer can shutdown this time. > > What the problem is?? > event if there was unsaved data. Apparently setting the cancel property to true was getting in the way of Windows being allowed to close. I had to look at the way windows was being asked to close and act accordingly, then allow the form to close and in turn allow Windows to close. Thanks Ray,
I have tried to comment the form closing event already, but the problem still here. Do you find any solution for this? Do you have any forms that are hidden at the time? They might be causing
issues. Show quoteHide quote "Cylix" <cylix2***@gmail.com> wrote in message news:1178261516.132828.16530@p77g2000hsh.googlegroups.com... > Thanks Ray, > > I have tried to comment the form closing event already, but the > problem still here. > Do you find any solution for this? > Cylix,
Use this code & it will do what you need: ' Exit Windows message Private Shared WM_QUERYENDSESSION As Integer = &H11 #Region "Window Proc (SUB)" <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissi ons.SecurityAction.Demand, Name:="FullTrust")> _ Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) ' Listen for operating system messages If m.Msg = WM_QUERYENDSESSION Then Application.Exit() End If ' Handle the message MyBase.WndProc(m) End Sub #End Region I hope this helps, -- Show quoteHide quoteNewbie Coder (It's just a name) "Ray Cassick" <rcass***@enterprocity.com> wrote in message news:eolL0lrjHHA.1216@TK2MSFTNGP03.phx.gbl... > Do you have any forms that are hidden at the time? They might be causing > issues. > > "Cylix" <cylix2***@gmail.com> wrote in message > news:1178261516.132828.16530@p77g2000hsh.googlegroups.com... > > Thanks Ray, > > > > I have tried to comment the form closing event already, but the > > problem still here. > > Do you find any solution for this? > > > > "Cylix" <cylix2***@gmail.com> wrote in message share share share.news:1178596376.593143.181380@l77g2000hsb.googlegroups.com... >I know the problem and solved it. > Thanks a lot. > Show quoteHide quote :)
Countdown
is there a control that displays a multi-column array of rectangles Talking with USB GPS in VB.Net Is This Overkill? Listing properties of an object Checking db connection open status File busy after sent via email Write to an Access database Help Converting Some C# Code to Visual Basic... Datagrid Multiple Select |
|||||||||||||||||||||||