Results 1 to 2 of 2

Thread: window system service?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    208

    window system service?

    Hi,
    I have a date program which I want to put in the System tray
    so that it checks the date every time and pops up the corresponding
    message .
    how do i do it ????

    thnks

  2. #2
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    Hi

    Hi,

    Have a look at this..

    VB Code:
    1. 'Download the full source+pictures+... at [url]http://kpdteam.hypermart.net/download/tray.zip[/url]
    2. Private Type NOTIFYICONDATA
    3.     cbSize As Long
    4.     hWnd As Long
    5.     uId As Long
    6.     uFlags As Long
    7.     ucallbackMessage As Long
    8.     hIcon As Long
    9.     szTip As String * 64
    10. End Type
    11.  
    12. Private Const NIM_ADD = &H0
    13. Private Const NIM_MODIFY = &H1
    14. Private Const NIM_DELETE = &H2
    15. Private Const NIF_MESSAGE = &H1
    16. Private Const NIF_ICON = &H2
    17. Private Const NIF_TIP = &H4
    18.  
    19. Private Const WM_LBUTTONDBLCLK = &H203
    20. Private Const WM_LBUTTONDOWN = &H201
    21. Private Const WM_RBUTTONUP = &H205
    22.  
    23. Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
    24. Dim TrayI As NOTIFYICONDATA
    25. Private Sub Form_Load()
    26.     TrayI.cbSize = Len(TrayI)
    27.     'Set the window's handle (this will be used to hook the specified window)
    28.     TrayI.hWnd = pichook.hWnd
    29.     'Application-defined identifier of the taskbar icon
    30.     TrayI.uId = 1&
    31.     'Set the flags
    32.     TrayI.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
    33.     'Set the callback message
    34.     TrayI.ucallbackMessage = WM_LBUTTONDOWN
    35.     'Set the picture (must be an icon!)
    36.     TrayI.hIcon = imgIcon(2).Picture
    37.     'Set the tooltiptext
    38.     TrayI.szTip = "Recent" & Chr$(0)
    39.     'Create the icon
    40.     Shell_NotifyIcon NIM_ADD, TrayI
    41.  
    42.     Me.Hide
    43. End Sub
    44. Private Sub Form_Unload(Cancel As Integer)
    45.     'remove the icon
    46.     TrayI.cbSize = Len(TrayI)
    47.     TrayI.hWnd = pichook.hWnd
    48.     TrayI.uId = 1&
    49.     Shell_NotifyIcon NIM_DELETE, TrayI
    50.     End
    51. End Sub
    52. Private Sub mnuPop_Click(Index As Integer)
    53.     Select Case Index
    54.         Case 0
    55.             MsgBox "KPD-Team 1998" + Chr$(13) + "URL: [url]http://www.allapi.net/[/url]" + Chr$(13) + "E-Mail: [email][email protected][/email]", vbInformation + vbOKOnly
    56.         Case 2
    57.             Unload Me
    58.     End Select
    59. End Sub
    60. Private Sub pichook_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    61.     Msg = X / Screen.TwipsPerPixelX
    62.     If Msg = WM_LBUTTONDBLCLK Then
    63.         'Left button double click
    64.         mnuPop_Click 0
    65.     ElseIf Msg = WM_RBUTTONUP Then
    66.         'Right button click
    67.         Me.PopupMenu mnuPopUp
    68.     End If
    69. End Sub
    70. Private Sub Timer1_Timer()
    71.     Static Tek As Integer
    72.     'Animate the icon
    73.     Me.Icon = imgIcon(Tek).Picture
    74.     TrayI.hIcon = imgIcon(Tek).Picture
    75.     Tek = Tek + 1
    76.     If Tek = 3 Then Tek = 0
    77.     Shell_NotifyIcon NIM_MODIFY, TrayI
    78. End Sub
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

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