CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: API help

  1. #1
    Join Date
    Mar 2007
    Posts
    4

    Unhappy API help

    I have a API spy that pulls all the information but I'm so used to using patorjk apy spy that generates all the code for you...

    I'm just trying to press down a mouse button on a command button on another program. Does anyone know where to download patorjk api spy or have that program, that could click the generate code for a WM_LBUTTONDOWN i notice on this forum theres 2 different ways to do it postmessage and sendmessage after i read that i got more confused. i have the hwnd number for the button i just need all the code thats required to send the key press , i cant believe how much i suck at api without that api spy

    please help.

    thanks in advance!
    -johndew




    p.s. its a window with 2 command buttons that pops up saying Are you away? i want it to click No when ever it pops up... Yes button is default and I want it to click the other button when ever it pops up... Thanks in advance


    i notice the hwnd keeps changing but the capation of it doesn't



    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

    Public Const WM_LBUTTONDOWN = &H201
    Public Const WM_LBUTTONUP = &H202





    start of timer1
    Child& = FindWindow("#32770", vbNullString)
    swtwindow& = FindWindowEx(Child&, 0&, "SWT_Window0", vbNullString)
    Button& = FindWindowEx(swtwindow&, 0&, "Button", vbNullString)
    Button& = FindWindowEx(swtwindow&, Button&, "Button", vbNullString)
    Call SendMessage(Button&, WM_LBUTTONDOWN, 0&, 0&)
    Call SendMessage(Button&, WM_LBUTTONUP, 0&, 0&)
    end of timer1


    child and swtwindow come with the numbers but button& comes to 0 tho

    why is button& comming to a 0? why isn't it picking it up


    i tried like so many things i cant get this to work for some odd reason
    Last edited by JohnDeW; March 23rd, 2007 at 06:43 AM.

  2. #2
    Join Date
    Dec 2006
    Location
    Pune, India.
    Posts
    579

    Re: API help

    Have a look at this:
    Attached Files Attached Files

  3. #3
    Join Date
    Mar 2007
    Posts
    4

    Re: API help

    heh i feel more confused now
    Last edited by JohnDeW; March 25th, 2007 at 05:26 AM.

  4. #4
    Join Date
    Mar 2007
    Posts
    4

    Re: API help

    bump

  5. #5
    Join Date
    Aug 2006
    Posts
    145

    Re: API help

    based on this code, click down on the attached form and drag the mouse over the button to generate VB code that'll find the hWnd - you can then just add your up/down bit

    Attached Files Attached Files

  6. #6
    Join Date
    Mar 2007
    Posts
    4

    Re: API help

    bump

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

Featured