Results 1 to 40 of 61

Thread: [RESOLVED] How to run any software in background?

Hybrid View

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question Re: how to run any software in background?

    @ 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
    Last edited by shakti5385; Jul 22nd, 2006 at 12:30 AM.

  2. #2
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: how to run any software in background?

    Quote 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:
    1. Option Explicit
    2.  
    3. '// FORM
    4.  
    5. Private Sub Form_Load()
    6.     mTray.Refresh Me                                    ' TRAY ICON LOAD
    7.     Me.Hide                                             ' HIDE FORM (MIN)
    8. End Sub
    9.  
    10. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    11.     mTray.Click Me, X                                   ' TRAY ICON CLICK
    12. End Sub
    13.  
    14. Private Sub Form_Resize()
    15.     mTray.Resize Me                                     ' TRAY ICON SHOW/HIDE
    16. End Sub
    17.  
    18. Private Sub Form_Unload(Cancel As Integer)
    19.     mTray.Destroy                                       ' TRAY ICON CLOSE
    20. End Sub
    21.  
    22. '// OPTIONAL - THE FOLLOWING 2 FORM EVENTS ARE FOR TERMINATING AND UNLOADING
    23.  
    24. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    25.     Cancel = vbNo
    26.     Me.Hide    ' program does not exit, it goes to system tray
    27.     '// IF YOU WANT TO ASK THEM IF THEY WANT TO EXIT DO SOMETHING LIKE THIS
    28.     '// IF THEY CLICK NO IT GOES TO THE SYSTEM TRAY, ELSE IT EXITS
    29.     '// Cancel = MsgBox("Exit My Program?", vbQuestion + vbYesNo, "Confirm Exit") = vbNo: Me.Hide
    30. End Sub
    31.  
    32. Private Sub Form_Terminate()
    33.     Unload Me
    34. 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
  •  



Click Here to Expand Forum to Full Width