|
-
Jan 14th, 2006, 03:49 PM
#1
Re: text write
Well I was using WinID to see the class name of the control where you enter the text in MSN, but something is weird.... All the controls, buttons, message window, and input window are all under the same Class, "DirectUIHwnd", as if its all drawn into one. I did something similar with a couple programs of mine with yahoo, but the input window was its own control, thus having its own unique hwnd to send the text to. Not sure how to go about it in MSN... Here's some function declarations you will need (.NET declarations...)
VB Code:
Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Int32
Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" ( _
ByVal hWnd1 As Int32, _
ByVal hWnd2 As Int32, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Int32
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Int32, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As String) As Int32
Public Const WM_SETTEXT As Long = &HC
Public Const WM_GETTEXT As Long = &HD
Now I tested this, and as expected, since all the controls are under the same Hwnd, the sendmessage when sending the text only changes the title of the DirectUIHwnd class shild window (and not visible unless you use Spy++ or WinID after)...
VB Code:
'IMWindowClass is the class name of a Private message window
'UserID - Conversation is the title of the messenger window, replace the userid
'with the userid you wish to test it on
Dim MainWindow As Integer = FindWindow("IMWindowClass", "UserID - Conversation")
MsgBox(MainWindow) 'should be a positive value if found
Dim ChildWindow As Integer = FindWindowEx(MainWindow, 0, "DirectUIHwnd", "")
MsgBox(ChildWindow) 'should be a positive value if found
'below, only sets the title text of the DirectUIHwnd class in the window (and isnt displayed anywhere,
'but viewable in WinID or SPY++
SendMessage(ChildWindow, WM_SETTEXT, 0, "Test")
Now if you run this a second time on the same window, you will get 0 for the childwindow, because the Title had changed to "Test" and is not blank. You would have to close out the window and open another...
Last edited by gigemboy; Jan 14th, 2006 at 03:53 PM.
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
|