- This topic has 5 replies, 3 voices, and was last updated 18 years ago by BattleStar-Galactica.
-
AuthorPosts
-
April 13, 2006 at 11:21 am #188944methodMember
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
April 13, 2006 at 12:01 pm #188949BattleStar-GalacticaMemberno need an expert for that, just me it’s ok 😆
try this code bellowPrivate 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 = &HCPrivate Sub Command1_Click()
Dim lNotepadHwnd As Long
Dim lNotepadEdit As Long
Dim sCaption As StringlNotepadHwnd = 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 SubApril 13, 2006 at 12:23 pm #188948methodMemberThank 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
April 13, 2006 at 12:28 pm #188947BattleStar-GalacticaMemberif 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 😥April 13, 2006 at 12:37 pm #188946methodMember@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 🙁
April 13, 2006 at 4:48 pm #188945DepartureMembermethod… 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
-
AuthorPosts
Related
- You must be logged in to reply to this topic.