Valhalla Legends Forums Archive | Visual Basic Programming | Hrmm i need help

AuthorMessageTime
-MichaeL-
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
November 1, 2003, 11:21 PM
Skywing
This has been discussed many times before. Please use the forum's search feature. It can help you get the information you need very quickly.
November 1, 2003, 11:56 PM
-MichaeL-
[quote author=Skywing link=board=31;threadid=3365;start=0#msg26863 date=1067731009]
This has been discussed many times before. Please use the forum's search feature. It can help you get the information you need very quickly.
[/quote]
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?
November 2, 2003, 12:25 AM
UserLoser.
[quote author=-MichaeL- link=board=31;threadid=3365;start=0#msg26856 date=1067728902][code]
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[/code]
[/quote]

Try putting that under Form_Resize()
November 2, 2003, 12:26 AM
-MichaeL-
[quote author=UserLoser. link=board=31;threadid=3365;start=0#msg26867 date=1067732770]
[quote author=-MichaeL- link=board=31;threadid=3365;start=0#msg26856 date=1067728902][code]
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[/code]
[/quote]

Try putting that under Form_Resize()
[/quote]
i used
[code]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[/code]
and it still wont unminimize from the tray
November 2, 2003, 12:28 AM
iago
.hwnd = bot.hwnd ' where bot = form name

Make sure that's right?
November 2, 2003, 12:34 AM
-MichaeL-
[quote author=iago link=board=31;threadid=3365;start=0#msg26872 date=1067733264]
Did you even read it?

.hwnd = bot.hwnd ' where bot = form name
[/quote]
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 :)
November 2, 2003, 12:35 AM
Grok
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.
November 2, 2003, 12:52 AM
-MichaeL-
[quote author=Grok link=board=31;threadid=3365;start=0#msg26879 date=1067734333]
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]
umm...
[code]
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
[/code]
well from what i understand that should be it
November 2, 2003, 12:55 AM
iago
eww, he quoted me in the ~30 seconds before I edited it :(
November 2, 2003, 1:01 AM
-MichaeL-
[quote author=iago link=board=31;threadid=3365;start=0#msg26888 date=1067734863]
eww, he quoted me in the ~30 seconds before I edited it :(
[/quote]
he sorry but i am watching the form likea hawk dont want to waste other peoples time by making them wait
November 2, 2003, 1:04 AM
Grok
[quote author=-MichaeL- link=board=31;threadid=3365;start=0#msg26891 date=1067735097]
[quote author=iago link=board=31;threadid=3365;start=0#msg26888 date=1067734863]
eww, he quoted me in the ~30 seconds before I edited it :(
[/quote]
he sorry but i am watching the form likea hawk dont want to waste other peoples time by making them wait
[/quote]

You only want to waste everyone's time by resurrecting > 30 day old posts?
November 2, 2003, 2:13 PM
Grok
[quote author=-MichaeL- link=board=31;threadid=3365;start=0#msg26882 date=1067734512]
[code]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[/code]
well from what i understand that should be it
[/quote]

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.
November 2, 2003, 2:23 PM
Adron
Dividing it by twips *is* a common way to implement that though.
November 2, 2003, 3:56 PM
-MichaeL-
[quote author=Grok link=board=31;threadid=3365;start=0#msg27020 date=1067782994]
[quote author=-MichaeL- link=board=31;threadid=3365;start=0#msg26882 date=1067734512]
[code]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[/code]
well from what i understand that should be it
[/quote]

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.
[/quote]

As i stated early,
[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
[/code]
it is defined, as &H201
November 2, 2003, 4:34 PM
Grok
[quote author=Adron link=board=31;threadid=3365;start=0#msg27034 date=1067788576]
Dividing it by twips *is* a common way to implement that though.
[/quote]

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.

[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[/code]
November 2, 2003, 4:54 PM
-MichaeL-
[quote author=Grok link=board=31;threadid=3365;start=15#msg27044 date=1067792052]
[quote author=Adron link=board=31;threadid=3365;start=0#msg27034 date=1067788576]
Dividing it by twips *is* a common way to implement that though.
[/quote]

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.

[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[/code]

[/quote]

I tried the code,
[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
[/code]
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?
November 2, 2003, 6:25 PM
Crim-Training
did you install the ocx by any chance ?

regsvr32 in Run followed by path
November 2, 2003, 7:02 PM
Adron
[quote author=Grok link=board=31;threadid=3365;start=15#msg27044 date=1067792052]
[quote author=Adron link=board=31;threadid=3365;start=0#msg27034 date=1067788576]
Dividing it by twips *is* a common way to implement that though.
[/quote]

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.
[/quote]

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".
November 2, 2003, 9:03 PM
-MichaeL-
[quote author=Crim-Training link=board=31;threadid=3365;start=15#msg27060 date=1067799729]
did you install the ocx by any chance ?

regsvr32 in Run followed by path
[/quote]
He didnt send me the .ocx could u send me it crim?
November 2, 2003, 10:45 PM
-MichaeL-
[quote author=Adron link=board=31;threadid=3365;start=15#msg27083 date=1067806991]
[quote author=Grok link=board=31;threadid=3365;start=15#msg27044 date=1067792052]
[quote author=Adron link=board=31;threadid=3365;start=0#msg27034 date=1067788576]
Dividing it by twips *is* a common way to implement that though.
[/quote]

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.
[/quote]

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]

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?
November 2, 2003, 10:48 PM
-MichaeL-
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.
November 3, 2003, 5:11 AM
iago
[quote author=-MichaeL- link=board=31;threadid=3365;start=15#msg27163 date=1067836302]
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]

huh?
November 3, 2003, 8:28 AM
Grok
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
November 3, 2003, 5:16 PM
Adron
[quote author=Grok link=board=31;threadid=3365;start=15#msg27215 date=1067879808]
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
[/quote]

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)
November 3, 2003, 6:54 PM
-MichaeL-
[quote author=Adron link=board=31;threadid=3365;start=15#msg27224 date=1067885692]
[quote author=Grok link=board=31;threadid=3365;start=15#msg27215 date=1067879808]
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
[/quote]

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]
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?
November 3, 2003, 7:58 PM
St0rm.iD
[quote author=-MichaeL- link=board=31;threadid=3365;start=15#msg27229 date=1067889512]
[quote author=Adron link=board=31;threadid=3365;start=15#msg27224 date=1067885692]
[quote author=Grok link=board=31;threadid=3365;start=15#msg27215 date=1067879808]
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
[/quote]

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]
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]

Periods?
November 3, 2003, 8:13 PM
-MichaeL-
[quote author=St0rm.iD link=board=31;threadid=3365;start=15#msg27233 date=1067890418]
[quote author=-MichaeL- link=board=31;threadid=3365;start=15#msg27229 date=1067889512]
[quote author=Adron link=board=31;threadid=3365;start=15#msg27224 date=1067885692]
[quote author=Grok link=board=31;threadid=3365;start=15#msg27215 date=1067879808]
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
[/quote]

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]
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]

Periods?
[/quote]
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?
November 3, 2003, 10:19 PM
MrRaza
sigh...
November 3, 2003, 10:42 PM
St0rm.iD
[quote author=-MichaeL- link=board=31;threadid=3365;start=15#msg27246 date=1067897946]
[quote author=St0rm.iD link=board=31;threadid=3365;start=15#msg27233 date=1067890418]
[quote author=-MichaeL- link=board=31;threadid=3365;start=15#msg27229 date=1067889512]
[quote author=Adron link=board=31;threadid=3365;start=15#msg27224 date=1067885692]
[quote author=Grok link=board=31;threadid=3365;start=15#msg27215 date=1067879808]
OK, since I don't know this technique and Adron does, I'll bow out and let him answer this question.
[/quote]

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]
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]

Periods?
[/quote]
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?
[/quote]

It was a suggestion for you not to look stupid, stupid.
November 4, 2003, 2:41 AM
Crim-Training
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 ?
November 5, 2003, 8:12 AM
-MichaeL-
[quote author=Crim-Training link=board=31;threadid=3365;start=30#msg27471 date=1068019923]
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]
Ya how could windows touching the edge of my program cause that, thats so gay. :(
November 5, 2003, 3:55 PM

Search