AIM text sender
Sprache: English
Programmiersprache: Visual Basic
Veröffentlicht von: krazygamer [nicht registriert]
Letzte Änderung: 15.05.2006
Aufrufe: 1561
Beschreibung
sends text to the active aol instant messenger window.
Code
1 Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
2 Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
3 Public Declare Function GetNextWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wFlag As Long) As Long
4 Public Declare Function FindWindowByClass Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
5 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
6
7 Function FindChildByClassN&(parent&, classname$, num%)
8 ' the FindChildByClassN function by the same guy didn't
9 ' work for me, so i made my own. *smiles proudly*
10 Dim temp$, child&, n As Integer, lng As Long
11 temp$ = String$(255, 0)
12 child& = FindChildByClass(parent&, classname$)
13 child& = GetNextWindow(child&, 1)
14 For n = 1 To num% - 1
15 10 child& = GetNextWindow(child&, 3)
16 If child& = 0 Then Exit For
17 DoEvents
18 lng = GetClassName(child&, temp$, 255)
19 If LCase(classname$) <> LCase(Left$(temp$, lng)) Then GoTo 10
20 Next
21 FindChildByClassN& = child&
22 End Function
23
24 Function FindChildByClass&(parent&, ByVal class$)
25 ' this little wonder was taken from http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=707&lngWId=1
26 ' don't sue me! i'm poor and i need to eat!
27 Dim temp$, class_$, child&, child_&
28 temp$ = String(255, 0)
29 child& = GetWindow(parent&, 5)
30 Do: DoEvents
31 class_$ = Left$(temp$, GetClassName(child&, temp$, 255))
32 If LCase(class$) = LCase(class_$) Then FindChildByClass& = child&: Exit Function
33 If GetWindow(child&, 5) <> 0 Then
34 child_& = FindChildByClass(child&, class$)
35 If child_& <> 0 Then FindChildByClass& = child_&: Exit Function
36 End If
37 child& = GetNextWindow(child&, 2)
38 Loop Until child& = 0
39 FindChildByClass& = 0
40 End Function
41
42 Public Function AIMSendText(strText As String) As Boolean
43 Dim wndChat As Long, wndChatTextParent As Long, wndChatTextBox As Long, wndChatSendButton As Long
44 wndChat = FindWindowByClass("AIM_IMessage", 0&)
45 wndChatSendButton = FindChildByClassN(wndChat, "_Oscar_IconBtn", 12)
46 wndChatTextParent = FindChildByClassN(wndChat, "WndAte32Class", 3)
47 wndChatTextBox = FindChildByClass(wndChatTextParent, "Ate32Class")
48 SendMessage wndChatTextBox, &HC, 0, ByVal strText
49 SendMessage wndChatSendButton, &H201, 0, 0
50 SendMessage wndChatSendButton, &H202, 0, 0
51 AIMSendText = (wndChat <> 0)
52 End Function
53
Noch kein Kommentar vorhanden
Dieses Snippet kommentieren
Name *
E-Mail (wird nicht angezeigt) *
Website
Kommentar *
Sicherheitscode *