Author | Message | Time |
---|---|---|
Spilled[DW] | I have been using the minimize to tray source i found upon this forum, i have ran into a problem and seeking your guys help once again. after having it minimized to tray for awhile it disappears but it's still running in my processes. Any ideas guys? Thanks in advance! Code: [code] 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 Global Const NIM_ADD = &H0 Global Const NIM_MODIFY = &H1 Global Const NIM_DELETE = &H2 Global Const WM_MOUSEMOVE = &H200 Global Const NIF_MESSAGE = &H1 Global Const NIF_ICON = &H2 Global Const NIF_TIP = &H4 Global Const WM_LBUTTONDBLCLK = &H203 'Double-click Global Const WM_LBUTTONDOWN = &H201 'Button down Global Const WM_LBUTTONUP = &H202 'Button up 'Right-click constants. Global Const WM_RBUTTONDBLCLK = &H206 'Double-click Global Const WM_RBUTTONDOWN = &H204 'Button down Global Const WM_RBUTTONUP = &H205 'Button up Declare Function Shell_NotifyIcon Lib "shell32" _ Alias "Shell_NotifyIconA" _ (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean Global nid As NOTIFYICONDATA Sub AddToTray(TrayIcon, TrayText As String, TrayForm As Form) 'Set the individual values of the NOTIFYICONDATA data type. nid.cbSize = Len(nid) nid.hwnd = TrayForm.hwnd nid.uId = vbNull nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE nid.uCallBackMessage = WM_MOUSEMOVE nid.hIcon = TrayIcon 'You can replace form1.icon with loadpicture=("icon's file name") nid.szTip = TrayText & vbNullChar 'Call the Shell_NotifyIcon function to add the icon to the taskbar 'status area. Shell_NotifyIcon NIM_ADD, nid TrayForm.Hide End Sub Sub ModifyTray(TrayIcon, TrayText As String, TrayForm As Form) nid.cbSize = Len(nid) nid.hwnd = TrayForm.hwnd nid.uId = vbNull nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE nid.uCallBackMessage = WM_MOUSEMOVE nid.hIcon = TrayIcon nid.szTip = TrayText & vbNullChar Shell_NotifyIcon NIM_MODIFY, nid End Sub Sub RemoveFromTray() Shell_NotifyIcon NIM_DELETE, nid End Sub Function RespondToTray(x As Single) RespondToTray = 0 Dim msg As Long Dim sFilter As String If frmMain.ScaleMode <> 3 Then msg = x / Screen.TwipsPerPixelX Else: msg = x Select Case msg Case WM_LBUTTONDOWN Case WM_LBUTTONUP Case WM_LBUTTONDBLCLK 'Left button double-clicked RespondToTray = 1 Case WM_RBUTTONDOWN 'Right button pressed RespondToTray = 2 Case WM_RBUTTONUP Case WM_RBUTTONDBLCLK End Select End Function Sub ShowFormAgain(TrayForm As Form) Call RemoveFromTray TrayForm.Show End Sub [/code] | August 25, 2005, 8:20 AM |
QwertyMonster | Why use that code? Why don't you use "System Tray Icon" in your Components folder. And then let's say we have a menu named mnuHide [code] Private Sub mnuHide_Click() MySysTrayName.intray = true MyForm.Hide End Sub [/code] And if you want it back [code] Private Sub MySysTrayName_Mousedown() '<-- One click and its back. You can have two clicks, or hover over. MySysTrayName.intray = False MyForm.Show End Sub [/code] And you can set the tooltip also for it, for like if you hover across it, it says "LoLBoT!! v1". | August 25, 2005, 11:26 AM |
Yegg | Maybe he doesn't want it to rely on another file? Visual Basic 6 relies on enough files as it is (mostly .ocx). | August 25, 2005, 3:07 PM |
Quarantine | Maybe he doesn't care, just hasn't seen the alternative provided by QwertyMonster :p | August 25, 2005, 3:17 PM |
QwertyMonster | I provided how he could do it, if he wants to do it that way, he can. I'm not saying "USE IT!!!! OR ELSE I EAT YOUR CHILDREN!!!11". | August 25, 2005, 10:11 PM |
Spilled[DW] | Yegg: Thank You Why rely on another file when i can code it myself? Anywayz, back to the topic, does anyone have any idea why this would be occuring? | August 26, 2005, 11:34 AM |
JoeTheOdd | 1) You should rely on another file because, as this topic is here, you can't code it yourself =p 2) You should rely on another file because if Microsoft releases a patch for a bug in it, you dont need to release a new bot. 3) This is general VB programming, not specifically Battle.net Bot Development. | August 26, 2005, 11:41 AM |
laurion | if it takes some time for it to disappear, id say explorer is crashing..someone posted how to make your icon reappear if this happens, search for it. | August 27, 2005, 2:01 AM |
Quarantine | [quote author=Joe[x86] link=topic=12615.msg125535#msg125535 date=1125056473] 1) You should rely on another file because, as this topic is here, you can't code it yourself =p 2) You should rely on another file because if Microsoft releases a patch for a bug in it, you dont need to release a new bot. 3) This is general VB programming, not specifically Battle.net Bot Development. [/quote] Reasons 1 and 2 are stupid. You are correct on 3. While he can't initially code it himself, perhaps he will see what he is doing wrong. Microsoft is unlikely to find a bug in MINIMIZING TO SYSTEM TRAY. | August 27, 2005, 2:49 AM |
JoeTheOdd | [quote]Microsoft is unlikely to find a bug in MINIMIZING TO SYSTEM TRAY.[/quote] Pfft, it could apply to other things too, though. =p | August 27, 2005, 11:54 AM |
Kp | [quote author=Warrior link=topic=12615.msg125630#msg125630 date=1125110944]Microsoft is unlikely to find a bug in MINIMIZING TO SYSTEM TRAY.[/quote] Agreed. They usually only find bugs after exploits for the bug have been in the wild for days or weeks. :) Exploiting any problem in the system tray code would be unlikely, since you'd generally have the ability to do much nastier things if you have the ability to manipulate the notification icons. | August 27, 2005, 4:31 PM |