|
-
Jun 27th, 2001, 10:05 AM
#1
Thread Starter
Lively Member
help!
I'm using this code
I want it to send Hello to text1.text
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
Dim sText As String
sText = "Hello"
SendMessage Text1.hwnd, WM_SETTEXT, 0, ByVal sText
End Sub
its not working
-
Jun 27th, 2001, 02:19 PM
#2
You need to define WM_SETTEXT.
VB Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SETTEXT = &HC
Private Sub Command1_Click()
Dim sText As String
sText = "Hello"
SendMessage Text1.hwnd, WM_SETTEXT, 0, ByVal sText
End Sub
-
Jun 27th, 2001, 04:56 PM
#3
Thread Starter
Lively Member
Thanks, now how would I beable to put "hello" in an ICQ message?
-
Jun 27th, 2001, 07:17 PM
#4
Thread Starter
Lively Member
ok i got this so far
VB Code:
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 FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Private Declare Function SendMessageByStr& Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal _
lParam As String)
Private Const WM_SETTEXT = &HC
Private Sub Command1_Click()
Dim x&
Dim richedit&
x& = FindWindow("#32770", vbNullString)
richedit& = FindWindowEx(x&, 0&, "richedit", vbNullChar)
SendMessageByStr richedit, WM_GETTEXT, 0, "hello"
End Sub
why won't it work?
-
Jun 27th, 2001, 07:24 PM
#5
New Member
Ummmm....... I dont know if you meant to do this, or even if it is the only error in your code, but you used WM_GETTEXT instead of WM_SETTEXT.
If you did want to use WM_GETTEXT, you would have to declare that in the same way.
-
Jun 27th, 2001, 07:37 PM
#6
Thread Starter
Lively Member
-
Jun 27th, 2001, 07:38 PM
#7
Thread Starter
Lively Member
oh it works man I am dumb!!
-
Jun 27th, 2001, 10:00 PM
#8
Addicted Member
just to let you know, #32770 is used for many differ windows...because #32770 is dialog and it might send it to 1 or more window, you might wanna try using the findwindow functino and use the caption of icq message box
-
Jun 27th, 2001, 10:05 PM
#9
Addicted Member
here this will send it to iccq message box, if u have the message window open
VB Code:
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 FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Long
Private Declare Function SendMessageByStr& Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal _
lParam As String)
Private Const WM_SETTEXT = &HC
Private Sub Command1_Click()
Dim x&
Dim richedit&
x& = FindWindow(vbNullString, "Send Online Message")
richedit& = FindWindowEx(x&, 0&, "richedit", vbNullChar)
SendMessageByStr richedit, WM_SETTEXT, 0, "hello"
End Sub
also if u use chat message mode, u would have to do somthing like this
x& = FindWindow(vbNullString, "FUBAR (Online) - Message Session")
which would be the title of the message window if u were sending to me
-
Jun 27th, 2001, 11:23 PM
#10
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|