home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / win95nt / program / msgblast / data.z / taskbar.bas < prev    next >
BASIC Source File  |  1995-09-07  |  2KB  |  79 lines

  1. Attribute VB_Name = "modTest"
  2. Option Explicit
  3.  
  4. 'Author:    Cris Williams
  5. '           74451.1245@compuserve.com
  6. '
  7. '           Are you a Lotus Ami Pro user?  If so, check out HelpMaker for Ami Pro
  8. '           found on Compuserve and on several sites on the Internet.  HelpMaker is
  9. '           a WinHelp authoring tool specifically for use with Ami Pro.  A Lotus
  10. '           Word Pro version is soon to follow.
  11. '           (pardon the plug)
  12. '
  13. '        This sample application is designed to demonstrate the functionality of adding
  14. '        an icon to the Win95 taskbar using Visual Basic 4.0.  It also demonstrates the
  15. '        usage of Message Blaster to receive Windows messages generated by mouse events
  16. '        which occur on the taskbar icon.
  17.  
  18. Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
  19. Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
  20.  
  21. Public Const NIF_ICON = &H2
  22. Public Const NIF_MESSAGE = &H1
  23. Public Const NIF_TIP = &H4
  24. Public Const NIM_ADD = &H0
  25. Public Const NIM_DELETE = &H2
  26. Public Const pnTOOLTIP_SZ As Integer = 64
  27.  
  28. Type NOTIFYICONDATA
  29.         cbSize As Long
  30.         hwnd As Long
  31.         uID As Long
  32.         uFlags As Long
  33.         uCallbackMessage As Long
  34.         hIcon As Long
  35.         szTip As String * pnTOOLTIP_SZ
  36. End Type
  37.  
  38. Public ptIconData As NOTIFYICONDATA
  39.  
  40. Sub AddIcon(oWindow As Object, lMsg As Long, sTooltip As String)
  41.  
  42.    On Error Resume Next
  43.  
  44.    Dim lResult As Long
  45.       
  46.       With ptIconData
  47.          .cbSize = Len(ptIconData)
  48.          .hwnd = oWindow.hwnd
  49.          .uID = oWindow.Icon
  50.          .uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
  51.          .uCallbackMessage = lMsg
  52.          .hIcon = oWindow.Icon
  53.          .szTip = sTooltip & Chr$(0)
  54.       End With
  55.    
  56.    lResult = Shell_NotifyIcon(NIM_ADD, ptIconData)
  57.  
  58. End Sub
  59.  
  60. Sub DelIcon()
  61.  
  62.    On Error Resume Next
  63.  
  64.    Dim lResult As Long
  65.    
  66.    lResult = Shell_NotifyIcon(NIM_DELETE, ptIconData)
  67.  
  68. End Sub
  69.  
  70.  
  71.  
  72. Sub Main()
  73.  
  74.    Load frmTaskbar
  75.    
  76. End Sub
  77.  
  78.  
  79.