|
-
Jul 22nd, 2006, 12:23 AM
#1
Thread Starter
Just Married
-
Jul 22nd, 2006, 12:40 AM
#2
PowerPoster
Re: how to run any software in background?
 Originally Posted by shakti5385
@ Roory....
your code running programme automatically whan i restart my pc again....
but u have any idea that how to show it at task bar
Thanks 
Hi .. do you mean the System Tray?
If so, in your program, in The Main Form Load use Me.Hide to hide the Form (program)..
See this code .. basically just copy the code in there into your project (copy the module into a new module and name it the same as i have it) .. add Me.Hide in your Form Load then it should automatically goto the system tray on loading the program .. to show your program again they simply left click on your program icon in the system tray ... and you can then minimize your program again to set it to the system tray.
http://www.vbforums.com/attachment.p...chmentid=49433
If you have problems with this let me know, ill throw together a custom version that auto hides on load.
This shows the code i attached in the Form, Modified to Auto Hide ..
Also i included the 2 form event examples, Terminate and Query Unload, incase you want to use those.
Also set Form ShowInTaskbar to False.
VB Code:
Option Explicit
'// FORM
Private Sub Form_Load()
mTray.Refresh Me ' TRAY ICON LOAD
Me.Hide ' HIDE FORM (MIN)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
mTray.Click Me, X ' TRAY ICON CLICK
End Sub
Private Sub Form_Resize()
mTray.Resize Me ' TRAY ICON SHOW/HIDE
End Sub
Private Sub Form_Unload(Cancel As Integer)
mTray.Destroy ' TRAY ICON CLOSE
End Sub
'// OPTIONAL - THE FOLLOWING 2 FORM EVENTS ARE FOR TERMINATING AND UNLOADING
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = vbNo
Me.Hide ' program does not exit, it goes to system tray
'// IF YOU WANT TO ASK THEM IF THEY WANT TO EXIT DO SOMETHING LIKE THIS
'// IF THEY CLICK NO IT GOES TO THE SYSTEM TRAY, ELSE IT EXITS
'// Cancel = MsgBox("Exit My Program?", vbQuestion + vbYesNo, "Confirm Exit") = vbNo: Me.Hide
End Sub
Private Sub Form_Terminate()
Unload Me
End Sub
Last edited by rory; Jul 22nd, 2006 at 12:56 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|