|
-
Feb 16th, 2000, 02:19 AM
#1
Thread Starter
Lively Member
Is there a way to "make my own TrayWindow" ?
I mean, how do I make so that instead of programs trying to create a "Shell Notify Icon" in Explorer's TrayWindow, It create the "Shell Notify Icon" in MY program, my own system tray.
I really, really, reeeealy want help with this.
-
Feb 16th, 2000, 09:20 AM
#2
Hyperactive Member
I wonder if maybe you could use a picture box, and put your icons in there as you need to. I wouldn't know how to get the other stuff into it, like the icons that go to the real tray, but your could put your own icons in the tray pretty easily.
-
Feb 16th, 2000, 11:44 PM
#3
Try somthing like this. Create a menu (call it mnuHidden,uncheck the Visible checkbox) and add two items to that menu (mnuShow and mnuExit), put a Picturebox on the form and set it's Visible property to False:
Code:
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Const NIF_ICON = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_TIP = &H4
Private Const NIM_ADD = &H0
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const WM_RBUTTONUP = &H205
Private tTrayIcon As NOTIFYICONDATA
Private Sub Form_Load()
With tTrayIcon
.hIcon = Icon
.hwnd = Picture1.hwnd
.szTip = Caption & Chr(0)
.uCallbackMessage = WM_MOUSEMOVE
.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
.uID = 1
.cbSize = Len(tTrayIcon)
End With
Shell_NotifyIcon NIM_ADD, tTrayIcon
End Sub
Private Sub Form_Resize()
If WindowState = vbMinimized Then
Hide
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Shell_NotifyIcon NIM_DELETE, tTrayIcon
End Sub
Private Sub mnuExit_Click()
Unload Me
End Sub
Private Sub mnuShow_Click()
Show
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case ScaleX(X, vbTwips, vbPixels)
Case WM_RBUTTONUP
Me.PopupMenu mnuHidden
End Select
End Sub
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 02-17-2000).]
-
Feb 17th, 2000, 03:22 AM
#4
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|