Results 1 to 10 of 10

Thread: Taskbar Problem

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Taskbar Problem

    Hi there,

    I have made an application which has only one form, i m running the application in startup and the code i got from the forum, it is working fine. Now the problem is that, I want my application to run in taskbar, means when system starts, application should run but the form should not be displayed on the screen until user double clicks the icon on the task bar.

    Thanx

  2. #2
    Addicted Member Cyberius's Avatar
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    145
    did u mean the taskbar (near the start button) or the system tray (near the clock)? im sure i have a module for the system tray
    -=[Ç¥ßè®Ìú§]=-

    How many microsoft employees does it take to change a lightbulb? None, they simply define darkness as the new industry standard.

    CAUTION: OVERCLOCKING A 386 TO 5Ghz MAY BE HAZARDOUS

  3. #3

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Taskbar Problem

    Near the clock.

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344
    VB Code:
    1. 'Puts app icon in the system tray
    2. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
    3.  
    4. Private Type NOTIFYICONDATA
    5.     cbSize As Long
    6.     hWnd As Long
    7.     uId As Long
    8.     uFlags As Long
    9.     ucallbackMessage As Long
    10.     hIcon As Long
    11.     szTip As String * 64
    12. End Type
    13.  
    14. Private Const NIM_ADD = &H0
    15. Private Const NIM_MODIFY = &H1
    16. Private Const NIM_DELETE = &H2
    17. Private Const WM_MOUSEMOVE = &H200
    18. Private Const NIF_MESSAGE = &H1
    19. Private Const NIF_ICON = &H2
    20. Private Const NIF_TIP = &H4
    21. Private Const WM_LBUTTONDBLCLK = &H203
    22. Private Const WM_LBUTTONDOWN = &H201
    23. Private Const WM_LBUTTONUP = &H202
    24. Private Const WM_RBUTTONDBLCLK = &H206
    25. Private Const WM_RBUTTONDOWN = &H204
    26. Private Const WM_RBUTTONUP = &H205
    27.  
    28. Private SysTray As NOTIFYICONDATA
    29. Dim Result As Long
    30. Private Sub StartInSysTray()
    31.     SysTray.cbSize = Len(SysTray)
    32.     SysTray.hWnd = Picture1.hWnd
    33.     SysTray.uId = 1&
    34.     SysTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    35.     SysTray.ucallbackMessage = WM_MOUSEMOVE
    36.     'change the below line to the desired icon
    37.     SysTray.hIcon = Me.Icon
    38.     SysTray.szTip = App.EXEName & ".exe"
    39.     Shell_NotifyIcon NIM_ADD, SysTray
    40.     Me.Hide
    41. End Sub
    42.  
    43. Private Sub Form_Load()
    44. StartInSysTray
    45. End Sub
    46.  
    47. Private Sub Form_Unload(Cancel As Integer)
    48.     'Remove the icon from the system tray
    49.     SysTray.cbSize = Len(SysTray)
    50.     SysTray.hWnd = Picture1.hWnd
    51.     SysTray.uId = 1&
    52.     Shell_NotifyIcon NIM_DELETE, SysTray
    53. End Sub
    54.  
    55. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
    56.  
    57. Static rec As Boolean, msg As Long
    58.     Dim RetVal As String
    59.     Dim returnstring
    60.     Dim retvalue
    61.     msg = x / Screen.TwipsPerPixelX
    62.     If rec = False Then
    63.         rec = True
    64.     Select Case msg
    65.     Case WM_LBUTTONDOWN
    66.    
    67.     Case WM_LBUTTONUP
    68.          
    69.     Case WM_RBUTTONDOWN
    70. 'Bring up the menu if the right mouse button is clicked over the icon
    71. If Button = vbRightButton Then
    72. PopupMenu mnuFile
    73. End If
    74.     Case WM_RBUTTONUP
    75.  
    76.     End Select
    77.         rec = False
    78.     End If
    79.  
    80. End Sub
    Last edited by Nightwalker83; Jan 5th, 2003 at 08:08 PM.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  5. #5

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308
    Hi there,

    Code is working fine and places the application in system tray, but on double clicking the icon on system tray, application is not coming on the desktop. Can u solve it ??

    Thanx for code.

  6. #6
    Fanatic Member
    Join Date
    Sep 2000
    Location
    Over There
    Posts
    522
    did you add code to the dblclick event to make it do so??
    if no you'll need to do that.
    It Never Fails. Everytime I try to make a program idiot proof, the world makes a better idiot.

  7. #7

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Taskbar Problem

    Double click event for which control. As soon as I runs the application, it comes in the system tray, so please tell me where and what code for the double click event.

    Thanx

  8. #8
    Fanatic Member
    Join Date
    Sep 2000
    Location
    Over There
    Posts
    522
    double click for picture1
    It Never Fails. Everytime I try to make a program idiot proof, the world makes a better idiot.

  9. #9

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308
    Sir, I will be thankful to you if you also send me the code for the double click of the picture to show the form on desktop because I am new in VB.

    Thanx

  10. #10
    Fanatic Member
    Join Date
    Sep 2000
    Location
    Over There
    Posts
    522
    VB Code:
    1. Private Sub Picture1_DblClick()
    2. Me.Show
    3. Me.WindowState = vbNormal
    4.  
    5. End Sub
    It Never Fails. Everytime I try to make a program idiot proof, the world makes a better idiot.

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