Results 1 to 1 of 1

Thread: How to send text to my own api ?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow How to send text to my own api ?

    HI all i am trying to send to an api using an example that i found in a website but i could not change it to my own api from notpad.

    I used window grabber to get the class name :

    Code:
    RichEdit20A
    #32770
    AtlAxWin71
    ATL:0053D798
    WTL_SplitterWindow
    WTL_SplitterWindow
    WTL_SplitterWindow
    My Window Class
    Code:
    Dim wtlsplitterwindow As Long, atld As Long, atlaxwin As Long
    Dim x As Long, richedita As Long
    wtlsplitterwindow = FindWindow("wtl_splitterwindow", vbNullString)
    wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
    wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
    atld = FindWindowEx(wtlsplitterwindow, 0&, "atl:0053d798", vbNullString)
    atlaxwin = FindWindowEx(atld, 0&, "atlaxwin71", vbNullString)
    x = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
    richedita = FindWindowEx(x, 0&, "richedit20a", vbNullString)
    richedita = FindWindowEx(x, richedita, "richedit20a", vbNullString)
    Call SendMessageLong(richedita, BM_SETCHECK, True, 0&)
    I be happy if an expert based on classe name above tell me what changes should i make to send text to my api instead of sending text to notepad. I assume my api textbox is already open. I tried to replaces the class name but i could not send text to my api!
    Here is the complete code:

    Code:
    Option Explicit
    
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private 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
    Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    Private Declare Function SendMessageLONG Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    
    Private Const WM_GETTEXT = &HD
    Private Const WM_SETTEXT = &HC
    Private Const EM_GETLINECOUNT = &HBA
    
    Private Sub CMDSENDEDIT_Click()
    Dim lNotepadHwnd As Long
    Dim lNotepadEdit As Long
    Dim sCaption As String
        
        lNotepadHwnd = FindWindow("Notepad", vbNullString)
        lNotepadEdit = FindWindowEx(lNotepadHwnd, 0&, "Edit", vbNullString)
    
        sCaption = InputBox("What do you want to say?")
        
        SendMessageSTRING lNotepadEdit, WM_SETTEXT, 256, sCaption
    End Sub
    Last edited by tony007; Apr 13th, 2006 at 09:55 AM.

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