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?
Printable View
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?
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 ;)
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?
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! :)Quote:
Originally Posted by penagate
http://files.bighosting.net/ti48554.jpg
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
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.VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, _ ByVal lpWindowName As String) _ As Long
Next call FindWindowEx,
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.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
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 :p 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! :)Quote:
Originally Posted by penagate
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?
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 :)
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!
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.