Results 1 to 11 of 11

Thread: Automatic

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    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?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    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?

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    Re: Automatic

    Quote 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!


  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    2.     (ByVal lpClassName As String, _
    3.      ByVal lpWindowName As String) _
    4.     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:
    1. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
    2.     (ByVal hWndParent As Long, _
    3.      ByVal hWndChildAfter As Long, _
    4.      ByVal lpszChildClass As String, _
    5.      ByVal lpszChildTitle As String) _
    6.     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

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    Re: Automatic

    Quote 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:
    1. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    2.     (ByVal lpClassName As String, _
    3.      ByVal lpWindowName As String) _
    4.     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:
    1. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
    2.     (ByVal hWndParent As Long, _
    3.      ByVal hWndChildAfter As Long, _
    4.      ByVal lpszChildClass As String, _
    5.      ByVal lpszChildTitle As String) _
    6.     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!

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    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?

  9. #9
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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:
    1. Dim hWndShareaza As Long
    2. 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

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    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!

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    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
  •  



Click Here to Expand Forum to Full Width