Victor Boyer
November 8th, 1999, 05:57 PM
This code works properly, except for the fact that after it puts up the tray icon, it doesn't make the window button disappear from the taskbar. What am I doing wrong? Thanks, Victor Boyer.
friend Function WndProc(byval hwnd as Long, byval wMsg as Long, _
byval wParam as Long, byval lParam as Long, bUseRetVal as Boolean) as Long
Dim di as DRAWITEMSTRUCT
Dim sTemp as string
Select Case wMsg
Case WM_SYSCOMMAND
' if it's a WM_SYSCOMMAND message then we want to examine it more carefully.
' check the word param (wParam) for our itemID. if it's ours, pop up the message box
If wParam = IDM_ABOUT then
frmAbout.Show vbModal, Form1
End If
If wParam = SC_MINIMIZE then
Call Shell_NotifyIcon(NIM_ADD, TrayIcon)
Form1.Visible = false
Form1.menu_showcheck.Checked = false
'Exit Function
End If
Case wMsg = WM_DRAWITEM
'Which panel to draw?
CopyMemory di, byval lParam, len(di)
'get the text we stored for this panel
sTemp = PanelText(di.itemID)
'Prepare the device context
SetBkMode di.hDC, TRANSPARENT
SetTextColor di.hDC, PanelColor(di.itemID)
'Draw our text
DrawText di.hDC, sTemp, len(sTemp), di.rcItem, _
DT_SINGLELINE + DT_RIGHT + DT_VCENTER
'Don't pass on to VB
WndProc = 1
bUseRetVal = true
End Select
End Function
friend Function WndProc(byval hwnd as Long, byval wMsg as Long, _
byval wParam as Long, byval lParam as Long, bUseRetVal as Boolean) as Long
Dim di as DRAWITEMSTRUCT
Dim sTemp as string
Select Case wMsg
Case WM_SYSCOMMAND
' if it's a WM_SYSCOMMAND message then we want to examine it more carefully.
' check the word param (wParam) for our itemID. if it's ours, pop up the message box
If wParam = IDM_ABOUT then
frmAbout.Show vbModal, Form1
End If
If wParam = SC_MINIMIZE then
Call Shell_NotifyIcon(NIM_ADD, TrayIcon)
Form1.Visible = false
Form1.menu_showcheck.Checked = false
'Exit Function
End If
Case wMsg = WM_DRAWITEM
'Which panel to draw?
CopyMemory di, byval lParam, len(di)
'get the text we stored for this panel
sTemp = PanelText(di.itemID)
'Prepare the device context
SetBkMode di.hDC, TRANSPARENT
SetTextColor di.hDC, PanelColor(di.itemID)
'Draw our text
DrawText di.hDC, sTemp, len(sTemp), di.rcItem, _
DT_SINGLELINE + DT_RIGHT + DT_VCENTER
'Don't pass on to VB
WndProc = 1
bUseRetVal = true
End Select
End Function