By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,903 Members | 1,626 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,903 IT Pros & Developers. It's quick & easy.

Info with system tray apps

P: n/a
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

Nov 9 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Wed, 9 Nov 2005 18:08:18 -0500, "Nicolas Poirier"
<ni***********@tlb.sympatico.ca> wrote:
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

Are you cancelling your program's shut down in any way ? Perhaps in
QueryUnlaod ?
If so, make sure that you trap the system shutdown. Look in the help
file for the UnloadMode passed into that event and it's meanings.
You should yield when the request comes from task manager and system
shut down; clean up, unload all your Forms, trayicon, objects, timers,
etc.. and finally your main form.

--

Regards, Frank
Nov 9 '05 #2

P: n/a

"Nicolas Poirier" <ni***********@tlb.sympatico.ca> wrote in message
news:Ej********************@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?

Unless there's something weird going on with your app, it should just
normally upon Windows shutting down. There's something "not right" about
your app that's preventing it from properly closing. Perhaps it has to do
with having added an icon to the system tray. You're not using WM_MOUSEMOVE
as the callback message (which is a hack), are you? Is your main form the
form used to add the icon to the system tray (IOW, the form used to specify
the hwnd of the NOTIFYICONDATA structure)?

You most likely need to post your code on how you're adding an icon to the
system tray as well as your shutdown code. That way, we can see exactly
what you're doing.

--
Mike
Microsoft MVP Visual Basic
Nov 10 '05 #3

P: n/a
"Nicolas Poirier" <ni***********@tlb.sympatico.ca> wrote in message
news:Ej********************@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..
Nov 10 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.