• Welcome to Valhalla Legends Archive.
 

Hrmm i need help

Started by Michael, November 01, 2003, 05:21 PM

Previous topic - Next topic

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

Skywing

#1
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.

Michael

#2
Quote from: Skywing on November 01, 2003, 05:56 PM
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.
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?

UserLoser.

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()

Michael

#4
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

iago

#5
.hwnd = bot.hwnd ' where bot = form name

Make sure that's right?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Michael

#6
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 :)

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.

Michael

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

iago

eww, he quoted me in the ~30 seconds before I edited it :(
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Michael

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

Grok

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?

Grok

#12
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.

Adron

Dividing it by twips *is* a common way to implement that though.

Michael

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