|
-
Jun 11th, 2005, 06:54 AM
#1
Thread Starter
Lively Member
Automatic
hey..is it possibloe to make an app that will..simulate a right-click then a key press? so it will right-click in another program..and control it? using the defined clicks and keys?
-
Jun 11th, 2005, 07:06 AM
#2
Re: Automatic
Sure... But be aware that a safer way of doing it is using window messages. They're what the program gets when you click anyway, so sending a window message directly is quicker. However, it is easier to code mouse movemements and keystrokes, and it's also fun to watch if you do it in slow motion
-
Jun 11th, 2005, 07:52 AM
#3
Thread Starter
Lively Member
Re: Automatic
In Shareaza. i want to be able to automatically "find more sources" for particular downloads or all of them..every 10mins or so..is this possible?
-
Jun 11th, 2005, 08:09 AM
#4
Re: Automatic
Do you have Spy++? If you do, use the window finder tool to grab the class name and title of the "Find more sources" button, and send it a WM_COMMAND message. If you don't have Spy++ or can't find it then grab Joacim Andersson's clone of the window finder tool here.
-
Jun 11th, 2005, 08:20 AM
#5
Thread Starter
Lively Member
Re: Automatic
 Originally Posted by penagate
Do you have Spy++? If you do, use the window finder tool to grab the class name and title of the "Find more sources" button, and send it a WM_COMMAND message. If you don't have Spy++ or can't find it then grab Joacim Andersson's clone of the window finder tool here.
i dont have spy++..i downloaded the tool..now can..u help me code an app that can find the shareaza window..then right-click a download box and click "Find More Sources" ? if u could id really appreciate it!
-
Jun 11th, 2005, 08:30 AM
#6
Re: Automatic
Hm... I'll try 
Open up JA's tool and drag the finder thing over the Shareaza Window, like the title or something, stop when you see the red line going around the whole window, and write down the class name.
Next do the same thing for the downloads area.
In your code, to find the window, call FindWindow
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
where lpClassName is the class name of the Shareaza window that you found 1st and lpWindowName is vbNullString. Save teh return value, that is your window handle.
Next call FindWindowEx,
VB Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWndParent As Long, _
ByVal hWndChildAfter As Long, _
ByVal lpszChildClass As String, _
ByVal lpszChildTitle As String) _
As Long
where hWndParent is the handle you got from FindWindow, hWndChildAfter is null (0&), lpszChildClass is the class name of the download area that you got 2nd, and lpszChildTitle is the title you got 2nd as well. Save that result too, its the handle of the download control that you'll need to send messages to.
Now I don't know how to do the menu thing, I guess you could do a right-click and then a click in the menu, but that isn't a very reliable method and if it went off while you were doing something it would be very annoying So I'm not really sure what message to send, perhaps someone else can help you with that part.
Anyways hope I started you off
-
Jun 11th, 2005, 09:27 AM
#7
Thread Starter
Lively Member
Re: Automatic
 Originally Posted by penagate
Hm... I'll try
Open up JA's tool and drag the finder thing over the Shareaza Window, like the title or something, stop when you see the red line going around the whole window, and write down the class name.
Next do the same thing for the downloads area.
In your code, to find the window, call FindWindow
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
where lpClassName is the class name of the Shareaza window that you found 1st and lpWindowName is vbNullString. Save teh return value, that is your window handle.
Next call FindWindowEx,
VB Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWndParent As Long, _
ByVal hWndChildAfter As Long, _
ByVal lpszChildClass As String, _
ByVal lpszChildTitle As String) _
As Long
where hWndParent is the handle you got from FindWindow, hWndChildAfter is null (0&), lpszChildClass is the class name of the download area that you got 2nd, and lpszChildTitle is the title you got 2nd as well. Save that result too, its the handle of the download control that you'll need to send messages to.
Now I don't know how to do the menu thing, I guess you could do a right-click and then a click in the menu, but that isn't a very reliable method and if it went off while you were doing something it would be very annoying  So I'm not really sure what message to send, perhaps someone else can help you with that part.
Anyways hope I started you off 
thanx m8!..i really do appreciate this. any more help would be great! because im pretty much a n00b 2 vb!
-
Jun 11th, 2005, 09:31 AM
#8
Thread Starter
Lively Member
Re: Automatic
in Window finder it showed up:
--------------------------
Handle: 000403D6
Class: ShareazaMainWnd
Text: Shareaza
---------------------------
so in VB i put:
-------------------------
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal ShareazaMainWnd As String, _
ByVal 000403D6 As String) _
As Long
---------------------------------------------------
is that right?
-
Jun 11th, 2005, 09:38 AM
#9
Re: Automatic
Sorry I should have explainged that calling the function better. I wasnt sure how much you knew about VB.
Leave the declare as it is at the top of the form/module code, and call it like this
VB Code:
Dim hWndShareaza As Long
hWndShareaza = FindWindow("ShareazaMainWnd", vbNullString)
Ignore the handle returned by Spy++, cos it's always going to be different.
Now do the Spy++ trick for the dwonload area
-
Jun 11th, 2005, 07:22 PM
#10
Thread Starter
Lively Member
Re: Automatic
This is for the Transfer (downloads) page:
Handle: 00040422
Class: AfxWnd70su
Text:
--------
thanx for the m8..im a total n00b here...so all help is sweet!
-
Jun 12th, 2005, 04:00 AM
#11
Thread Starter
Lively Member
Re: Automatic
Hey. Is there anyone out there that would be willing to help me code this? im sure it would be useful to alot of people!..A application that can find the Shareaza Transfer Window, then 'Find More Sources' for the downloads listed there.
Shareaza is Open-Source in C++. Im Learning VB (a total n00b!) so it would be good if someone could code it in VB for me.
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
|