|
-
Apr 11th, 2004, 06:06 PM
#1
Thread Starter
New Member
Windows API
Ok guys,
I used PAT or JK's API SPY 51.exe as an API spy. I then checked the option to generate the code that clicks the button I release the cursor on. The code generated is supposed to click the play button on winamp from my visual basic application. It generated this
Code:
Private Sub Command1_Click()
Dim winampvx As Long
winampvx = FindWindow("winamp v1.x", vbNullString)
Call SendMessageLong(winampvx, WM_LBUTTONDOWN, 0&, 0&)
Call SendMessageLong(winampvx, WM_LBUTTONUP, 0&, 0&)
End Sub
But see... FindWindow isnt declared nor is SendMessageLong. I believe I need a module for this? What do I need to make this work? I'm sorry for the bad explanation I don't know how else to put it. Thanks for the help in advance.
-
Apr 11th, 2004, 06:13 PM
#2
Put in a module :
VB Code:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Has someone helped you? Then you can Rate their helpful post. 
-
Apr 11th, 2004, 06:25 PM
#3
Thread Starter
New Member
same thing...
Ok that didnt work... SendMessageLong still wasnt declared so i changed
Code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
to
Code:
Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
And then i stopped getting errors, but it didnt work at all!!!
-
Apr 11th, 2004, 06:31 PM
#4
-
Apr 11th, 2004, 06:33 PM
#5
Member
Well when u call
VB Code:
Call SendMessageLong(winampvx, WM_LBUTTONDOWN, 0&, 0&)
That's a generic mouse button down, you do not specify where it happens, so the code wont work unless you pass the point where the left mouse button was clicked. I could never figure out how to do that but that's the reason the code wont click your button.
NOW if u got the direct handle of the button you want to click this code would work, and is what i'd suggest doing.
Good programming site:
*http://www.planet-source-code.com
Our CS Clan Page:
*http://h2p.inter-gamer.com/index.html
-
Apr 11th, 2004, 06:43 PM
#6
-
Apr 11th, 2004, 10:05 PM
#7
The picture isn't missing
Remember, if someone's post was not helpful, you can always rate their post negatively  .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|