Author | Message | Time |
---|---|---|
LackLuster) | I am implementing this: https://davnit.net/bnet/vL/phpbbs/index.php?topic=612.msg4583#msg4583 It goes down, but won't pull back up, I have looked over the code, and have found nothing as to why it would be doing this... Any suggestions? | August 7, 2005, 4:20 AM |
Lenny | Well if you don't show the code, we can only guess and poke fun at you. Also, this isn't in the correct forum. | August 7, 2005, 5:19 AM |
LackLuster) | Did you click the link...? Uhm, that IS the code, and it IS bot developement (it's for a bot...)... So, would it be rude for me to ask you to please click links before you post...? | August 7, 2005, 6:27 AM |
Lenny | Ah, so you copy and pasted, I don't think you can call that implementation. | August 7, 2005, 6:32 AM |
LackLuster) | It pretty much fit... And I am going to say it is his module, it's not like I am saying "I CODED IT IT'S ALL ORINGAL!"... | August 7, 2005, 6:53 AM |
Lenny | Since I can't be sure how you're using this code, the only guess I can make is you missed reading the last post in that thread or one of the methods in that post that wasn't enclosed by the code tags. | August 7, 2005, 7:09 AM |
LackLuster) | [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 Form1.ScaleMode <> 3 Then msg = X / Screen.TwipsPerPixelX Else: msg = X Select Case msg Case WM_LBUTTONDOWN Call ShowFormAgain Case WM_LBUTTONUP Call ShowFormAgain Case WM_LBUTTONDBLCLK 'Left button double-clicked Call ShowFormAgain 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 frmMain.Show End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If RespondToTray(X) <> 0 Then Call ShowFormAgain(Me) End Sub Private Sub Form_Unload(Cancel As Integer) Call RemoveFromTray End Sub[/code] That is all in a module... Also, I have it initializing (Going to tray) if you click a menu button "Hide"... | August 7, 2005, 7:20 AM |
Lenny | From what I can remember of VB, I believe you want this: [code] Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If RespondToTray(X) <> 0 Then Call ShowFormAgain(Me) End Sub Private Sub Form_Unload(Cancel As Integer) Call RemoveFromTray End Sub [/code] in the form which you want to send to the tray. | August 7, 2005, 7:27 AM |
Networks | I have had huge problems with the seemingly popular way people do tray support. I use a subclassed version, one open source class I believe can be found in q Bot or something to that affect. And I've found this method to work better and 100% of the time for me and it's the only method I use. Here's where you can find the class: http://www.zeroforce.net/pafiledb/pafiledb.php?action=file&id=182 | August 7, 2005, 3:27 PM |
Kp | FYI, your NOTIFYICONDATA structure is both misnamed and incomplete. :) Its proper names are NOTIFYICONDATAA and NOTIFYICONDATAW, depending on whether you're using the old ANSI version or the new Unicode version. Also, you're missing quite a few new members, which means you won't be able to take advantage of many of the new features introduced in Win2k and WinXP. A more complete definition, taken from the w32api component of the MinGW project: [code]typedef struct _NOTIFYICONDATAW { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if _WIN32_IE >= 0x0500 WCHAR szTip[128]; DWORD dwState; DWORD dwStateMask; WCHAR szInfo[256]; _ANONYMOUS_UNION union { UINT uTimeout; UINT uVersion; } DUMMYUNIONNAME; WCHAR szInfoTitle[64]; DWORD dwInfoFlags; #else WCHAR szTip[64]; #endif #if _WIN32_IE >= 0x600 GUID guidItem; #endif } NOTIFYICONDATAW,*PNOTIFYICONDATAW;[/code] | August 7, 2005, 4:17 PM |
MyStiCaL | I Just just MicroSofts systray control... :| simple n easy.. | August 8, 2005, 8:35 AM |
QwertyMonster | I use that too. And then you use it like this: [code] Private Sub Hide_Click() sysTray1.InTray = True frmMain.Hide End Sub [/code] And then when i want it back [code] Private Sub sysTray1_MouseDown() sysTray1.InTray = False frmMain.Show End Sub [/code] That is how i do it.. | August 8, 2005, 11:49 AM |