Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Send text to the active AOL Instant Messenger wind...
Author:
KrazyGamer
E-mail:
Click to e-mail author
Submitted:
4/12/2002
Version:
VB5
Compatibility:
VB5, VB6
Category:
Internet Programming
Views:
12099
Send text to the active AOL Instant Messenger window.
Declarations:
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Public Declare Function GetNextWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wFlag As Long) As Long Public Declare Function FindWindowByClass Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Code:
Function FindChildByClassN&(parent&, classname$, num%) ' the FindChildByClassN function by the same guy didn't ' work for me, so i made my own. *smiles proudly* Dim temp$, child&, n As Integer, lng As Long temp$ = String$(255, 0) child& = FindChildByClass(parent&, classname$) child& = GetNextWindow(child&, 1) For n = 1 To num% - 1 10 child& = GetNextWindow(child&, 3) If child& = 0 Then Exit For DoEvents lng = GetClassName(child&, temp$, 255) If LCase(classname$) <> LCase(Left$(temp$, lng)) Then GoTo 10 Next FindChildByClassN& = child& End Function Function FindChildByClass&(parent&, ByVal class$) ' this little wonder was taken from http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=707&lngWId=1 ' don't sue me! i'm poor and i need to eat! Dim temp$, class_$, child&, child_& temp$ = String(255, 0) child& = GetWindow(parent&, 5) Do: DoEvents class_$ = Left$(temp$, GetClassName(child&, temp$, 255)) If LCase(class$) = LCase(class_$) Then FindChildByClass& = child&: Exit Function If GetWindow(child&, 5) <> 0 Then child_& = FindChildByClass(child&, class$) If child_& <> 0 Then FindChildByClass& = child_&: Exit Function End If child& = GetNextWindow(child&, 2) Loop Until child& = 0 FindChildByClass& = 0 End Function Public Function AIMSendText(strText As String) As Boolean Dim wndChat As Long, wndChatTextParent As Long, wndChatTextBox As Long, wndChatSendButton As Long wndChat = FindWindowByClass("AIM_IMessage", 0&) wndChatSendButton = FindChildByClassN(wndChat, "_Oscar_IconBtn", 12) wndChatTextParent = FindChildByClassN(wndChat, "WndAte32Class", 3) wndChatTextBox = FindChildByClass(wndChatTextParent, "Ate32Class") SendMessage wndChatTextBox, &HC, 0, ByVal strText SendMessage wndChatSendButton, &H201, 0, 0 SendMessage wndChatSendButton, &H202, 0, 0 AIMSendText = (wndChat <> 0) End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement