XPost: comp.lang.basic.visual, comp.lang.basic.visual.misc, micr   
   soft.public.vb.general.discussion   
   From: Ken_Halter@Use_Sparingly_Hotmail.com   
      
   "Nicolas Poirier" wrote in message   
   news:Ejvcf.14673$1L3.623284@news20.bellglobal.com...   
   >I successfully made a system tray application.   
   > When I do shut down the computer, how does the computer can instruct my   
   > application to shut down?   
   > For the moment, if I don't quit my application, system asks to kill an   
   > unresponsive task before shut sown.   
   > How does I make shut down run more correctly?   
   >   
   > Thank you   
   > Nicolas Poirier   
      
   'If you have something like this in one of your forms.....   
   '=======   
   Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)   
    Cancel = True   
    Me.Hide   
   End Sub   
   '=======   
      
   'Change that to:   
   '=======   
   Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)   
    If UnloadMode = vbFormControlMenu Then   
    Cancel = True   
    Me.Hide   
    End If   
   End Sub   
   '=======   
      
   So it only cancels the unload if the user clicks the close button or menu.   
   The OS can still shut it down.   
      
   --   
   Ken Halter - MS-MVP-VB - http://www.vbsight.com   
   DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm   
   Please keep all discussions in the groups..   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|