Skip to content
Home > Programming > How to send text to my own api ?

How to send text to my own api ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #188944
    method
    Member

    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 :


    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:



    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

    #188949

    no need an expert for that, just me it’s ok 😆
    try this code bellow

    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 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 Const WM_GETTEXT = &HD
    Private Const WM_GETTEXTLENGTH = &HE
    Private Const WM_SETTEXT = &HC

    Private Sub Command1_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?”)

    Call SendMessageSTRING(lNotepadEdit, WM_SETTEXT, 0&, sCaption$)
    End Sub

    #188948
    method
    Member

    Thank u for u reply . I tried and nothing get sent to my api textbox.No errors: Well let me mention the textbox is the paltalk textbox!!Hope u point me to where things needed to be changed from my orginal code since i want to learns this thing.Thanks

    #188947

    if you want send text to pt room, there are too many sources on this forum.
    my reply it’s i though you want to send the text you get from inputbox to notepad 😥

    #188946
    method
    Member

    @nanomachine007 wrote:

    if you want send text to pt room, there are too many sources on this forum.
    my reply it’s i though you want to send the text you get from inputbox to notepad 😥

    lol. That is what the code was doing !! And i wanted to change it 🙁

    #188945
    Departure
    Member

    method… first you must understand what the code is doing before you go trying to change things………

    if you can come back and explain to me what each line of code does and why the API call and what it does then i can teach you alot more.

    until then trust me when i say please play some more with source code and tutorials

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.