VB6 How to write an application icon in a drag tray
Source: Internet
Author: User
1, the new establishment of a VB6 project, the Form1 ShowInTaskbar property set to False
2, Menu: Project--Add Module Press "OPEN" This adds a new module, named Module1, save as Module1.bas
3, write down the following code in the Module1:
Option Explicit
Public Const Max_tooltip as Integer = 64
Public Const Nif_icon = &h2
Public Const nif_message = &h1
Public Const Nif_tip = &h4
Public Const Nim_add = &h0
Public Const Nim_delete = &h2
Public Const wm_mousemove = &h200
Public Const Wm_lbuttondown = &h201
Public Const Wm_lbuttonup = &h202
Public Const WM_LBUTTONDBLCLK = &h203
Public Const Wm_rbuttondown = &h204
Public Const Wm_rbuttonup = &h205
Public Const WM_RBUTTONDBLCLK = &h206
Public Const Sw_restore = 9
Public Const sw_hide = 0
Public Nficondata as Notifyicondata
Public Type Notifyicondata
cbsize as Long
HWnd as Long
UID as Long
Uflags as Long
Ucallbackmessage as Long
Hicon as Long
Sztip as String * max_tooltip
End Type
Public Declare Function ShowWindow Lib "user32" (ByVal hWnd as Long, ByVal nCmdShow as long) as long
Public Declare Function Shell_NotifyIcon Lib "Shell32.dll" Alias "Shell_notifyicona" (ByVal dwmessage as Long, lpdata as N Otifyicondata) as Long
4, write down the following code in the Form1 Load event:
Private Sub Form_Load ()
' Below put the program into System tray====================================system Tray Begin
With Nficondata
. hWnd = Me.hwnd
. UID = Me.icon
. uflags = Nif_icon or Nif_message or Nif_tip
. Ucallbackmessage = Wm_mousemove
. Hicon = Me.Icon.Handle
' Tip to define when the mouse is moved to the pallet
. Sztip = App.title + "(Version & App.major &." & App.minor & "." & App.revision & ")" & VBNULLC Har
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.