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: Select all
RichEdit20A
#32770
AtlAxWin71
ATL:0053D798
WTL_SplitterWindow
WTL_SplitterWindow
WTL_SplitterWindow
My Window Class
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: Select all
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




