Results 1 to 8 of 8

Thread: New to API

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10

    New to API

    Ok, Isn't API where you can find like the TEXT box thingy in the program? Well I use 6.0 Enterprise and I want to find the API for a program. I have no clue on what to do.
    Crazy ZIPPO

  2. #2
    DaoK
    Guest
    Isn't API where you can find like the TEXT box thingy in the program?
    What do you want ? What is the thingy ? You mean carret?

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2001
    Posts
    10
    Its arcmatch.exe, I want to find the Text box that you write your text in and find a way to make it Enter when done.
    Crazy ZIPPO

  4. #4
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    First off, API is Application Programming Interface, which allows you to do a load of things not possible in regular windows (like shutdown windows, draw squiggles, change window shapes, etc, etc).

    If you want to find the hwnd of a textbox, use the Findwindow API:

    VB Code:
    1. Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. 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
    3.  
    4.  
    5. USAGE:
    6. var = FindWindowEx(FindWindow(vbNullString, "Window's Text"), 0&, "Edit", vbNullString)

    You should really start off by understanding the API with something like Karl Moore's API Tutorial, Part I of I.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  5. #5
    Megatron
    Guest
    What do you mean by "make it enter?"

  6. #6
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Ah, and you don't find the "API" of a program. You can, however, find the process ID of a program or the hwnd of a window in a program, but not the API (because API is a group of Windows functions compiled with C that is NOT specific to a program).

    If you mean stimulating an Enter keystroke, use this:

    VB Code:
    1. Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    2. 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
    3. 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
    4. Public Const WM_KEYDOWN = &H100
    5. Public Const WM_KEYUP = &H101
    6. Public Const WM_CHAR = &H102
    7.  
    8.  
    9. USAGE:
    10. Dim hvar As Long
    11. hvar = FindWindowEx(FindWindow(vbNullString, "Window's Text"), 0&, "Edit", vbNullString
    12. SendMessage hvar, WM_KEYDOWN, 13, 0
    13. SendMessage hvar, WM_KEYUP, 13, 0
    14. SendMessage hvar, WM_KEYCHAR, 13, 0

    +=
    +=


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  7. #7
    Megatron
    Guest
    Originally posted by Microbasic
    If you mean stimulating an Enter keystroke:
    You mean simulating, right? ;-)

    (Sorry; I'm a major grammar freak).

  8. #8
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Yes, oh great one, simulating.

    simulating
    simulating
    simulating
    simulating
    simulating
    simulating
    simulating
    simulating
    simulating
    simulating

    There, now I'll remember it.

    Oh, and Megatron, you mean Sorry, I'm a major grammar freak, right?


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

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