Results 1 to 30 of 30

Thread: API Newbie

Hybrid View

  1. #1
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: API Newbie

    You misunderstood me on the 13 part. I meant, instead of using variablle WM_GETTEXT in one of the parameters, just put value 13.

    make buffer = space(len) to buffer = " " make it 255 blank spaces.

  2. #2

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    Re: API Newbie

    Ok i hope i did this right, here is what i have, atleast it builds, but when i hit the button it dosent do anything":

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    4. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    5. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Long
    6.  
    7.     Public Sub proc()
    8.         Dim hwnd As Long
    9.         Dim hwndEx As Long
    10.  
    11.         'gets handle of notepad
    12.         hwnd = FindWindow("Notepad", vbNullString)
    13.  
    14.         'gets handle of 'edit' area of notepad
    15.         hwndEx = FindWindowEx(hwnd, vbNullString, "edit", vbNullString)
    16.         Dim x As Integer
    17.         x = 1
    18.         Dim buffer As String    'buffer will contain the text from notepad
    19.         buffer = "                                                       "
    20.        
    21.         'sends WM_GETTEXT message to 'edit' area of notepad
    22.         Dim x As Integer
    23.         x = SendMessage(hwndEx, 13, buffer)
    24.         buffer = buffer.Substring(0, x)
    25.         Text1.Text = buffer
    26.  
    27.     End Sub

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