Program : VB6
Problem : Bot minimizes to tray but will not come back
Code :
Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Public 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
'constants required by Shell_NotifyIcon API call:
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201 'Button down
Public Const WM_LBUTTONUP = &H202 'Button up
Public Const WM_LBUTTONDBLCLK = &H203 'Double-click
Public Const WM_RBUTTONDOWN = &H204 'Button down
Public Const WM_RBUTTONUP = &H205 'Button up
Public Const WM_RBUTTONDBLCLK = &H206 'Double-click
Public Declare Function SetForegroundWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Public NID As NOTIFYICONDATA
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
On Error Resume Next
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
Me.Show
Me.SetFocus
Me.WindowState = 0
'Shell_NotifyIcon NIM_DELETE, NID
Case WM_LBUTTONUP
Case WM_LBUTTONDBLCLK
Case WM_RBUTTONDOWN
Case WM_RBUTTONUP '517 display popup menu
End Select
End Sub
Private Sub Form_Load()
'Form Load
With NID
.cbSize = Len(NID)
.hwnd = Bot.hwnd
.uID = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Bot.icon
.szTip = "Zone Bot By GDN-MiKe" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, NID
End Sub
Please tell me why it would not work
This has been discussed many times before (http://forum.valhallalegends.com/phpbbs/index.php?action=search2&search=Tray+icon&submit=Search&advanced=0). Please use the forum's search feature. It can help you get the information you need very quickly.
Quote from: Skywing on November 01, 2003, 05:56 PM
This has been discussed many times before (http://forum.valhallalegends.com/phpbbs/index.php?action=search2&search=Tray+icon&submit=Search&advanced=0). Please use the forum's search feature. It can help you get the information you need very quickly.
i did skywing but they are the codes it showed also same for shadow bot and stealth bot but it just dont seem to work could it be a bug or something with my Visual Basic?
Quote from: -MichaeL- on November 01, 2003, 05:21 PM
With NID
.cbSize = Len(NID)
.hwnd = Bot.hwnd
.uID = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Bot.icon
.szTip = "Zone Bot By GDN-MiKe" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, NID
Try putting that under Form_Resize()
Quote from: UserLoser. on November 01, 2003, 06:26 PM
Quote from: -MichaeL- on November 01, 2003, 05:21 PM
With NID
.cbSize = Len(NID)
.hwnd = Bot.hwnd
.uID = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Bot.icon
.szTip = "Zone Bot By GDN-MiKe" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, NID
Try putting that under Form_Resize()
i used
Private Sub form_resize()
With NID
.cbSize = Len(NID)
.hwnd = Bot.hwnd ' Bot = form name
.uID = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallbackMessage = WM_MOUSEMOVE
.hIcon = Bot.icon
.szTip = "Zone Bot By GDN-MiKe" & vbNullChar
End With
Shell_NotifyIcon NIM_ADD, NID
End Sub
and it still wont unminimize from the tray
.hwnd = bot.hwnd ' where bot = form name
Make sure that's right?
Quote from: iago on November 01, 2003, 06:34 PM
Did you even read it?
.hwnd = bot.hwnd ' where bot = form name
yes i did and so did userloser ima talking with him on aim
Notice the 'which makes it not used but as a define for you so you can understand better :)
On which event are you expecting your bot to restore window state? I don't see any code you wrote which provides that opportunity. There's no popup menu or any other mechanism to cause the restore.
Quote from: Grok on November 01, 2003, 06:52 PM
On which event are you expecting your bot to restore window state? I don't see any code you wrote which provides that opportunity. There's no popup menu or any other mechanism to cause the restore.
umm...
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
On Error Resume Next
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
Me.Show
Me.SetFocus
Me.WindowState = 0
'Shell_NotifyIcon NIM_DELETE, NID
Case WM_LBUTTONUP
Case WM_LBUTTONDBLCLK
Case WM_RBUTTONDOWN
Case WM_RBUTTONUP '517 display popup menu
End Select
End Sub
well from what i understand that should be it
eww, he quoted me in the ~30 seconds before I edited it :(
Quote from: iago on November 01, 2003, 07:01 PM
eww, he quoted me in the ~30 seconds before I edited it :(
he sorry but i am watching the form likea hawk dont want to waste other peoples time by making them wait
Quote from: -MichaeL- on November 01, 2003, 07:04 PM
Quote from: iago on November 01, 2003, 07:01 PM
eww, he quoted me in the ~30 seconds before I edited it :(
he sorry but i am watching the form likea hawk dont want to waste other peoples time by making them wait
You only want to waste everyone's time by resurrecting > 30 day old posts?
Quote from: -MichaeL- on November 01, 2003, 06:55 PM
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
On Error Resume Next
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
Me.Show
Me.SetFocus
Me.WindowState = 0
'Shell_NotifyIcon NIM_DELETE, NID
Case WM_LBUTTONUP
Case WM_LBUTTONDBLCLK
Case WM_RBUTTONDOWN
Case WM_RBUTTONUP '517 display popup menu
End Select
End Sub
well from what i understand that should be it
How is dividing the current X position of the cursor by Screen.TwipsPerPixelX going to reliably result in the value of a windows message constant, in particular WM_LBUTTONDOWN? The value of this symbol does not change, yet your X and msg change whenever the mouse changes horizontal position across the form.
#define WM_LBUTTONDOWN = 0x201
First let me hear your thoughts on this, before I post the answer by pressing the correct Button.
Dividing it by twips *is* a common way to implement that though.
Quote from: Grok on November 02, 2003, 08:23 AM
Quote from: -MichaeL- on November 01, 2003, 06:55 PM
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
On Error Resume Next
Dim msg As Long
Dim sFilter As String
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDOWN
Me.Show
Me.SetFocus
Me.WindowState = 0
'Shell_NotifyIcon NIM_DELETE, NID
Case WM_LBUTTONUP
Case WM_LBUTTONDBLCLK
Case WM_RBUTTONDOWN
Case WM_RBUTTONUP '517 display popup menu
End Select
End Sub
well from what i understand that should be it
How is dividing the current X position of the cursor by Screen.TwipsPerPixelX going to reliably result in the value of a windows message constant, in particular WM_LBUTTONDOWN? The value of this symbol does not change, yet your X and msg change whenever the mouse changes horizontal position across the form.
#define WM_LBUTTONDOWN = 0x201
First let me hear your thoughts on this, before I post the answer by pressing the correct Button.
As i stated early,
Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Public 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
'constants required by Shell_NotifyIcon API call:
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201 'Button down
Public Const WM_LBUTTONUP = &H202 'Button up
Public Const WM_LBUTTONDBLCLK = &H203 'Double-click
Public Const WM_RBUTTONDOWN = &H204 'Button down
Public Const WM_RBUTTONUP = &H205 'Button up
Public Const WM_RBUTTONDBLCLK = &H206 'Double-click
Public Declare Function SetForegroundWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Public NID As NOTIFYICONDATA
it is defined, as &H201
Quote from: Adron on November 02, 2003, 09:56 AM
Dividing it by twips *is* a common way to implement that though.
Dividing the current cursor X position by twipsperpixelX will reliably result in 0x201, telling you when the left mouse button is pressed? I don't think so. X varies, TPPX is a constant, and WM_LBUTTONDOWN is a constant. And so far, none of that tells you the state of the mouse buttons.
-Michael-, check the value of Button (and value of Shift if you care). These will tell you when to change WindowState to 0-vbNormal. Get rid of that msg=x/TPPX stuff.
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Button
Case vbLeftButton '1 Left button is pressed.
Me.Show
Me.SetFocus
Me.WindowState = vbNormal
Case vbRightButton '2 Right button is pressed.
PopupMenu mnuPopup
Case vbMiddleButton '4 Middle button is pressed.
End Select
End Sub
Quote from: Grok on November 02, 2003, 10:54 AM
Quote from: Adron on November 02, 2003, 09:56 AM
Dividing it by twips *is* a common way to implement that though.
Dividing the current cursor X position by twipsperpixelX will reliably result in 0x201, telling you when the left mouse button is pressed? I don't think so. X varies, TPPX is a constant, and WM_LBUTTONDOWN is a constant. And so far, none of that tells you the state of the mouse buttons.
-Michael-, check the value of Button (and value of Shift if you care). These will tell you when to change WindowState to 0-vbNormal. Get rid of that msg=x/TPPX stuff.
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Button
Case vbLeftButton '1 Left button is pressed.
Me.Show
Me.SetFocus
Me.WindowState = vbNormal
Case vbRightButton '2 Right button is pressed.
PopupMenu mnuPopup
Case vbMiddleButton '4 Middle button is pressed.
End Select
End Sub
I tried the code,
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Button
Case vbLeftButton '1 Left button is pressed.
Me.Show
Me.SetFocus
Me.WindowState = vbNormal
Case vbRightButton '2 Right button is pressed.
PopupMenu mnuPopup
Case vbMiddleButton '4 Middle button is pressed.
End Select
End Sub
I cannot seem to understand why it is not coming back from the tray.
Well i also have something that may be the answer to it my friend suggested useing a .OCX system tray icon1.0.ocx, when i went to use it i found out my vb dosnt have it. Could that be the reason it does not work do i need the .ocx?
did you install the ocx by any chance ?
regsvr32 in Run followed by path
Quote from: Grok on November 02, 2003, 10:54 AM
Quote from: Adron on November 02, 2003, 09:56 AM
Dividing it by twips *is* a common way to implement that though.
Dividing the current cursor X position by twipsperpixelX will reliably result in 0x201, telling you when the left mouse button is pressed? I don't think so. X varies, TPPX is a constant, and WM_LBUTTONDOWN is a constant. And so far, none of that tells you the state of the mouse buttons.
Yes it does.
That is a trick I've seen used in more than one place to get around the fact that you cannot define your own windows message handlers in VB. What you do when you need a user defined message then, is that instead of passing in something like WM_USER+1, you tell windows to call you back with WM_MOUSEMOVE. You can then get to the loword of lParam by knowing that VB has multiplied it by twipsperpixelx and is passing it to you as "X".
Quote from: Crim-Training on November 02, 2003, 01:02 PM
did you install the ocx by any chance ?
regsvr32 in Run followed by path
He didnt send me the .ocx could u send me it crim?
Quote from: Adron on November 02, 2003, 03:03 PM
Quote from: Grok on November 02, 2003, 10:54 AM
Quote from: Adron on November 02, 2003, 09:56 AM
Dividing it by twips *is* a common way to implement that though.
Dividing the current cursor X position by twipsperpixelX will reliably result in 0x201, telling you when the left mouse button is pressed? I don't think so. X varies, TPPX is a constant, and WM_LBUTTONDOWN is a constant. And so far, none of that tells you the state of the mouse buttons.
Yes it does.
That is a trick I've seen used in more than one place to get around the fact that you cannot define your own windows message handlers in VB. What you do when you need a user defined message then, is that instead of passing in something like WM_USER+1, you tell windows to call you back with WM_MOUSEMOVE. You can then get to the loword of lParam by knowing that VB has multiplied it by twipsperpixelx and is passing it to you as "X".
I don't mean to impose but, when crim sent me his source he used twipsperpixelX. same with shadow and stealth so i guess it works?
hrmm i think my comps having problems cuz when i signed in with my aol browser i was banned and then with ie and i am not banned i no its off topic but i was wondering if you could explain why.
Quote from: -MichaeL- on November 02, 2003, 11:11 PM
hrmm i think my comps having problems cuz when i signed in with my aol browser i was banned and then with ie and i am not banned i no its off topic but i was wondering if you could explain why.
huh?
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
Quote from: Grok on November 03, 2003, 11:16 AM
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
I don't know it, I just recognize it and have copy-pasted it from an example once or twice. If I'd known what was wrong I'd have answerred already :)
edit: (my copy-paste of it worked fine btw)
Quote from: Adron on November 03, 2003, 12:54 PM
Quote from: Grok on November 03, 2003, 11:16 AM
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
I don't know it, I just recognize it and have copy-pasted it from an example once or twice. If I'd known what was wrong I'd have answerred already :)
edit: (my copy-paste of it worked fine btw)
Well im glad that yours worked but early today i found out crim has start having the same problems as me could it have something to do with a virus or a virus program or some other type of program?
Quote from: -MichaeL- on November 03, 2003, 01:58 PM
Quote from: Adron on November 03, 2003, 12:54 PM
Quote from: Grok on November 03, 2003, 11:16 AM
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
I don't know it, I just recognize it and have copy-pasted it from an example once or twice. If I'd known what was wrong I'd have answerred already :)
edit: (my copy-paste of it worked fine btw)
Well im glad that yours worked but early today i found out crim has start having the same problems as me could it have something to do with a virus or a virus program or some other type of program?
Periods?
Quote from: St0rm.iD on November 03, 2003, 02:13 PM
Quote from: -MichaeL- on November 03, 2003, 01:58 PM
Quote from: Adron on November 03, 2003, 12:54 PM
Quote from: Grok on November 03, 2003, 11:16 AM
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
I don't know it, I just recognize it and have copy-pasted it from an example once or twice. If I'd known what was wrong I'd have answerred already :)
edit: (my copy-paste of it worked fine btw)
Well im glad that yours worked but early today i found out crim has start having the same problems as me could it have something to do with a virus or a virus program or some other type of program?
Periods?
if you cant understand what i write then dont respond no one told u to be a jerk did they or maybe you have no manners?
sigh...
Quote from: -MichaeL- on November 03, 2003, 04:19 PM
Quote from: St0rm.iD on November 03, 2003, 02:13 PM
Quote from: -MichaeL- on November 03, 2003, 01:58 PM
Quote from: Adron on November 03, 2003, 12:54 PM
Quote from: Grok on November 03, 2003, 11:16 AM
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
I don't know it, I just recognize it and have copy-pasted it from an example once or twice. If I'd known what was wrong I'd have answerred already :)
edit: (my copy-paste of it worked fine btw)
Well im glad that yours worked but early today i found out crim has start having the same problems as me could it have something to do with a virus or a virus program or some other type of program?
Periods?
if you cant understand what i write then dont respond no one told u to be a jerk did they or maybe you have no manners?
It was a suggestion for you not to look stupid, stupid.
i had the same prob, so i went back step by step and my prob was having windows touching the edge, beleive it or not!
This also work for mike so wtf ?
Quote from: Crim-Training on November 05, 2003, 02:12 AM
i had the same prob, so i went back step by step and my prob was having windows touching the edge, beleive it or not!
This also work for mike so wtf ?
Ya how could windows touching the edge of my program cause that, thats so gay. :(