home *** CD-ROM | disk | FTP | other *** search
Wrap
Attribute VB_Name = "Master32" Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal lpBuffer As String, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Sub RtlMoveMemory Lib "kernel32" (ByRef dest As Any, ByRef Source As Any, ByVal nBytes As Long) Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long Declare Function dwGetStringFromLPSTR Lib "dwspy32.dll" (ByVal lpcopy As Long) As String Declare Sub dwCopyDataBynum Lib "dwspy32.dll" Alias "dwCopyData" (ByVal Source&, ByVal dest&, ByVal nCount&) Declare Function dwGetAddressForObject& Lib "dwspy32.dll" (object As Any) Declare Sub dwCopyDataByString Lib "dwspy32.dll" Alias "dwCopyData" (ByVal Source As String, ByVal dest As Long, ByVal nCount&) Declare Function dwXCopyDataBynumFrom& Lib "dwspy32.dll" Alias "dwXCopyDataFrom" (ByVal mybuf As Long, ByVal foreignbuf As Long, ByVal size As Integer, ByVal foreignPID As Long) Declare Function dwGetWndInstance& Lib "dwspy32.dll" (ByVal hwnd&) Declare Function RegisterWindowMessage& Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) Declare Function SendMessageByNum& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) Declare Function GetClassName& Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long Declare Function CreatePopupMenu Lib "user32" () As Long Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Declare Function GetTopWindow Lib "user32" (ByVal hwnd As Long) As Long Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As Long, ByVal wIDItem As Long, ByVal lpString As String, ByVal nMaxCount As Long, ByVal wFlag As Long) As Long Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Declare Function InsertMenu Lib "user32" Alias "InsertMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As String) As Long Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As String) As Long Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long Declare Function DestroyMenu Lib "user32" (ByVal hMenu%) As Integer Public Const WM_CHAR = &H102 Public Const WM_SETTEXT = &HC Public Const WM_USER = &H400 Public Const WM_KEYDOWN = &H100 Public Const WM_KEYUP = &H101 Public Const WM_LBUTTONDOWN = &H201 Public Const WM_LBUTTONUP = &H202 Public Const WM_CLOSE = &H10 Public Const WM_COMMAND = &H111 Public Const WM_CLEAR = &H303 Public Const WM_DESTROY = &H2 Public Const WM_GETTEXT = &HD Public Const WM_GETTEXTLENGTH = &HE Public Const WM_LBUTTONDBLCLK = &H203 Public Const BM_GETCHECK = &HF0 Public Const BM_GETSTATE = &HF2 Public Const BM_SETCHECK = &HF1 Public Const BM_SETSTATE = &HF3 Public Const LB_GETITEMDATA = &H199 Public Const LB_GETCOUNT = &H18B Public Const LB_ADDSTRING = &H180 Public Const LB_DELETESTRING = &H182 Public Const LB_FINDSTRING = &H18F Public Const LB_FINDSTRINGEXACT = &H1A2 Public Const LB_GETCURSEL = &H188 Public Const LB_GETTEXT = &H189 Public Const LB_GETTEXTLEN = &H18A Public Const LB_SELECTSTRING = &H18C Public Const LB_SETCOUNT = &H1A7 Public Const LB_SETCURSEL = &H186 Public Const LB_SETSEL = &H185 Public Const LB_INSERTSTRING = &H181 Public Const VK_HOME = &H24 Public Const VK_RIGHT = &H27 Public Const VK_CONTROL = &H11 Public Const VK_DELETE = &H2E Public Const VK_DOWN = &H28 Public Const VK_LEFT = &H25 Public Const VK_RETURN = &HD Public Const VK_SPACE = &H20 Public Const VK_TAB = &H9 Public Const HWND_TOP = 0 Public Const HWND_TOPMOST = -1 Public Const HWND_NOTOPMOST = -2 Public Const SWP_NOMOVE = &H2 Public Const SWP_NOSIZE = &H1 Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Public Const GW_CHILD = 5 Public Const GW_HWNDFIRST = 0 Public Const GW_HWNDLAST = 1 Public Const GW_HWNDNEXT = 2 Public Const GW_HWNDPREV = 3 Public Const GW_MAX = 5 Public Const GW_OWNER = 4 Public Const SW_MAXIMIZE = 3 Public Const SW_MINIMIZE = 6 Public Const SW_HIDE = 0 Public Const SW_RESTORE = 9 Public Const SW_SHOW = 5 Public Const SW_SHOWDEFAULT = 10 Public Const SW_SHOWMAXIMIZED = 3 Public Const SW_SHOWMINIMIZED = 2 Public Const SW_SHOWMINNOACTIVE = 7 Public Const SW_SHOWNOACTIVATE = 4 Public Const SW_SHOWNORMAL = 1 Public Const MF_APPEND = &H100& Public Const MF_DELETE = &H200& Public Const MF_CHANGE = &H80& Public Const MF_ENABLED = &H0& Public Const MF_DISABLED = &H2& Public Const MF_REMOVE = &H1000& Public Const MF_POPUP = &H10& Public Const MF_STRING = &H0& Public Const MF_UNCHECKED = &H0& Public Const MF_CHECKED = &H8& Public Const MF_GRAYED = &H1& Public Const MF_BYPOSITION = &H400& Public Const MF_BYCOMMAND = &H0& Public Const GWW_HINSTANCE = (-6) Public Const GWW_ID = (-12) Public Const GWL_STYLE = (-16) Public Const PROCESS_VM_READ = &H10 Public Const STANDARD_RIGHTS_REQUIRED = &HF0000 Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Type POINTAPI X As Long Y As Long End Type Public Function AOLGetList(index As Long, buffer As String) On Error Resume Next Dim AOLProcess As Long Dim ListItemHold As Long Dim Person As String Dim ListPersonHold As Long Dim ReadBytes As Long room = AOLFindRoom() aolhandle = FindChildByClass(room, "_AOL_Listbox") AOLThread = GetWindowThreadProcessId(aolhandle, AOLProcess) AOLProcessThread = OpenProcess(PROCESS_VM_READ Or STANDARD_RIGHTS_REQUIRED, False, AOLProcess) If AOLProcessThread Then Person$ = String$(4, vbNullChar) ListItemHold = SendMessage(aolhandle, LB_GETITEMDATA, ByVal CLng(index), ByVal 0&) ListItemHold = ListItemHold + 24 Call ReadProcessMemory(AOLProcessThread, ListItemHold, Person$, 4, ReadBytes) Call RtlMoveMemory(ListPersonHold, ByVal Person$, 4) ListPersonHold = ListPersonHold + 6 Person$ = String$(16, vbNullChar) Call ReadProcessMemory(AOLProcessThread, ListPersonHold, Person$, Len(Person$), ReadBytes) Person$ = Left$(Person$, InStr(Person$, vbNullChar) - 1) Call CloseHandle(AOLProcessThread) End If buffer$ = Person$ End Function Function AddListToString(thelist As ListBox) For DoList = 0 To thelist.ListCount - 1 AddListToString = AddListToString & thelist.List(DoList) & ", " Next DoList AddListToString = Mid(AddListToString, 1, Len(AddListToString) - 2) End Function Sub AddStringToList(theitems, thelist As ListBox) If Not Mid(theitems, Len(theitems), 1) = "," Then theitems = theitems & "," End If For DoList = 1 To Len(theitems) thechars$ = thechars$ & Mid(theitems, DoList, 1) If Mid(theitems, DoList, 1) = "," Then thelist.AddItem Mid(thechars$, 1, Len(thechars$) - 1) thechars$ = "" If Mid(theitems, DoList + 1, 1) = " " Then DoList = DoList + 1 End If End If Next DoList End Sub Function AOLClickList(hwnd) clicklist% = SendMessageByNum(hwnd, &H203, 0, 0&) End Function Function AOLCountMail() themail% = FindChildByClass(AOLMDI(), "AOL Child") thetree% = FindChildByClass(themail%, "_AOL_Tree") AOLCountMail = SendMessage(thetree%, LB_GETCOUNT, 0, 0) End Function Sub AOLOpenChat() If AOLFindRoom() Then Exit Sub AOLKeyword ("pc") Do: DoEvents Loop Until AOLFindRoom() End Sub Sub AOLOpenMail(which) If which = 1 Then Call AOLRunMenuByString("Read &New Mail") End If If which = 2 Then Call AOLRunMenuByString("Check Mail You've &Read") End If If Not which = 1 Or Not which = 2 Then Call AOLRunMenuByString("Check Mail You've &Sent") End If End Sub Sub AOLRespondIM(message) IM% = FindChildByTitle(AOLMDI(), ">Instant Message From:") If IM% Then GoTo Z IM% = FindChildByTitle(AOLMDI(), " Instant Message From:") If IM% Then GoTo Z Exit Sub Z: e = FindChildByClass(IM%, "RICHCNTL") e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e = GetWindow(e, 2) e2 = GetWindow(e, 2) 'Send Text e = GetWindow(e2, 2) 'Send Button Call AOLSetText(e2, message) AOLIcon (e) End Sub Sub AOLRunMenuByString(stringer As String) Call RunMenuByString(AOLWindow(), stringer) End Sub Sub AOLWaitMail() mailwin% = GetTopWindow(AOLMDI()) aoltree% = FindChildByClass(mailwin%, "_AOL_Tree") Do: DoEvents firstcount = SendMessage(aoltree%, LB_GETCOUNT, 0, 0) Pause (3) secondcount = SendMessage(aoltree%, LB_GETCOUNT, 0, 0) If firstcount = secondcount Then Exit Do Loop End Sub Function EncryptType(text, types) 'to encrypt, example: 'encrypted$ = EncryptType("messagetoencrypt", 0) 'to decrypt, example: 'decrypted$ = EncryptType("decryptedmessage", 1) '* First Paramete is the Message '* Second Parameter is 0 for encrypt ' or 1 for decrypt For God = 1 To Len(text) If types = 0 Then Current$ = Asc(Mid(text, God, 1)) - 1 Else Current$ = Asc(Mid(text, God, 1)) + 1 End If Process$ = Process$ & Chr(Current$) Next God EncryptType = Process$ End Function Function FindChildByTitle(parentw, childhand) firs% = GetWindow(parentw, 5) If UCase(GetCaption(firs%)) Like UCase(childhand) Then GoTo bone firs% = GetWindow(parentw, GW_CHILD) While firs% firss% = GetWindow(parentw, 5) If UCase(GetCaption(firss%)) Like UCase(childhand) & "*" Then GoTo bone firs% = GetWindow(firs%, 2) If UCase(GetCaption(firs%)) Like UCase(childhand) & "*" Then GoTo bone Wend FindChildByTitle = 0 bone: room% = firs% FindChildByTitle = room% End Function Function FindChildByClass(parentw, childhand) firs% = GetWindow(parentw, 5) If UCase(Mid(GetClass(firs%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone firs% = GetWindow(parentw, GW_CHILD) If UCase(Mid(GetClass(firs%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone While firs% firss% = GetWindow(parentw, 5) If UCase(Mid(GetClass(firss%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone firs% = GetWindow(firs%, 2) If UCase(Mid(GetClass(firs%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone Wend FindChildByClass = 0 bone: room% = firs% FindChildByClass = room% End Function Function DescrambleText(thetext) 'sees if there's a space in the text to be scrambled, 'if found space, continues, if not, adds it findlastspace = Mid(thetext, Len(thetext), 1) If Not findlastspace = " " Then thetext = thetext & " " Else thetext = thetext End If 'Descrambles the text For scrambling = 1 To Len(thetext) thechar$ = Mid(thetext, scrambling, 1) Char$ = Char$ & thechar$ If thechar$ = " " Then 'takes out " " space from the text left of the space chars$ = Mid(Char$, 1, Len(Char$) - 1) 'gets first character firstchar$ = Mid(chars$, 1, 1) 'gets last character (if not, makes first character only) On Error GoTo city lastchar$ = Mid(chars$, 2, 1) 'finds what is inbetween the last and first character midchar$ = Mid(chars$, 3, Len(chars$) - 2) 'reverses the text found in between the last and first 'character For SpeedBack = Len(midchar$) To 1 Step -1 backchar$ = backchar$ & Mid$(midchar$, SpeedBack, 1) Next SpeedBack GoTo sniffed 'adds the scrambled text to the full scrambled element city: scrambled$ = scrambled$ & firstchar$ & " " GoTo sniff sniffed: scrambled$ = scrambled$ & lastchar$ & backchar$ & firstchar$ & " " 'clears character and reversed buffers sniff: Char$ = "" backchar$ = "" End If Next scrambling 'Makes function return value the scrambled text DescrambleText = scrambled$ End Function Function GetLineCount(text) theview$ = text For FindChar = 1 To Len(theview$) thechar$ = Mid(theview$, FindChar, 1) If thechar$ = Chr(13) Then numline = numline + 1 End If Next FindChar If Mid(text, Len(text), 1) = Chr(13) Then GetLineCount = numline Else GetLineCount = numline + 1 End If End Function Function IntegerToString(tochange As Integer) As String IntegerToString = Str$(tochange) End Function Function LineFromText(text, theline) theview$ = text For FindChar = 1 To Len(theview$) thechar$ = Mid(theview$, FindChar, 1) thechars$ = thechars$ & thechar$ If thechar$ = Chr(13) Then c = c + 1 thechatext$ = Mid(thechars$, 1, Len(thechars$) - 1) If theline = c Then GoTo ex thechars$ = "" End If Next FindChar Exit Function ex: thechatext$ = ReplaceText(thechatext$, Chr(13), "") thechatext$ = ReplaceText(thechatext$, Chr(10), "") LineFromText = thechatext$ End Function Function NumericNumber(thenumber) NumericNumber = Val(thenumber) 'turns the "number" so vb recognizes it for 'addition, subtraction, ect. End Function Sub ParentChange(Parent%, location%) doparent% = SetParent(Parent%, location%) End Sub Function RandomNumber(finished) Randomize RandomNumber = Int((Val(finished) * Rnd) + 1) End Function Function ReverseText(text) For Words = Len(text) To 1 Step -1 ReverseText = ReverseText & Mid(text, Words, 1) Next Words End Function Sub RunMenuByString(Application, StringSearch) ToSearch% = GetMenu(Application) MenuCount% = GetMenuItemCount(ToSearch%) For FindString = 0 To MenuCount% - 1 ToSearchSub% = GetSubMenu(ToSearch%, FindString) MenuItemCount% = GetMenuItemCount(ToSearchSub%) For GetString = 0 To MenuItemCount% - 1 SubCount% = GetMenuItemID(ToSearchSub%, GetString) MenuString$ = String$(100, " ") GetStringMenu% = GetMenuString(ToSearchSub%, SubCount%, MenuString$, 100, 1) If InStr(UCase(MenuString$), UCase(StringSearch)) Then MenuItem% = SubCount% GoTo MatchString End If Next GetString Next FindString MatchString: RunTheMenu% = SendMessage(Application, WM_COMMAND, MenuItem%, 0) End Sub Sub AOLRunTool(tool) toolbar% = FindChildByClass(AOLWindow(), "AOL Toolbar") iconz% = FindChildByClass(toolbar%, "_AOL_Icon") For X = 1 To tool - 1 iconz% = GetWindow(iconz%, 2) Next X isen% = IsWindowEnabled(iconz%) If isen% = 0 Then Exit Sub AOLIcon (iconz%) End Sub Function ScrambleGame(thestring As String) Dim bytestring As String thestringcount = Len(thestring$) If Not Mid(thestring$, thestringcount, 1) = " " Then thestring$ = thestring$ & " " For Stringe = 1 To Len(thestring$) characters$ = Mid(thestring$, Stringe, 1) thestrings$ = thestrings$ & characters$ If characters$ = " " Then smoked: DoEvents For Ensemble = 1 To Len(thestrings$) - 1 Randomize randomstring = Int((Len(thestrings$) * Rnd) + 1) If randomstring = Len(thestrings$) Then GoTo already If bytesread Like "*" & randomstring & "*" Then GoTo already stringrandom$ = Mid(thestrings$, randomstring, 1) stringfound$ = stringfound$ & stringrandom$ bytesread = bytesread & randomstring GoTo really already: Ensemble = Ensemble - 1 really: Next Ensemble If stringfound$ = thestrings$ Then stringfound$ = "": GoTo smoked thestrings2$ = thestrings2$ & stringfound$ & " " stringfound$ = "" thestrings$ = "" bytesread = "" strngfound$ = "" End If Next Stringe ScrambleGame = Mid(thestrings2$, 1, Len(thestring$) - 1) End Function Function ScrambleText(thetext) 'sees if there's a space in the text to be scrambled, 'if found space, continues, if not, adds it findlastspace = Mid(thetext, Len(thetext), 1) If Not findlastspace = " " Then thetext = thetext & " " Else thetext = thetext End If 'Scrambles the text For scrambling = 1 To Len(thetext) thechar$ = Mid(thetext, scrambling, 1) Char$ = Char$ & thechar$ If thechar$ = " " Then 'takes out " " space from the text left of the space chars$ = Mid(Char$, 1, Len(Char$) - 1) 'gets first character firstchar$ = Mid(chars$, 1, 1) 'gets last character (if not, makes first character only) On Error GoTo cityz lastchar$ = Mid(chars$, Len(chars$), 1) 'finds what is inbetween the last and first character midchar$ = Mid(chars$, 2, Len(chars$) - 2) 'reverses the text found in between the last and first 'character For SpeedBack = Len(midchar$) To 1 Step -1 backchar$ = backchar$ & Mid$(midchar$, SpeedBack, 1) Next SpeedBack GoTo sniffe 'adds the scrambled text to the full scrambled element cityz: scrambled$ = scrambled$ & firstchar$ & " " GoTo sniffs sniffe: scrambled$ = scrambled$ & lastchar$ & firstchar$ & backchar$ & " " 'clears character and reversed buffers sniffs: Char$ = "" backchar$ = "" End If Next scrambling 'Makes function return value the scrambled text ScrambleText = scrambled$ Exit Function End Function Function ReplaceText(text, charfind, charchange) If InStr(text, charfind) = 0 Then ReplaceText = text Exit Function End If For Replace = 1 To Len(text) thechar$ = Mid(text, Replace, 1) thechars$ = thechars$ & thechar$ If thechar$ = charfind Then thechars$ = Mid(thechars$, 1, Len(thechars$) - 1) + charchange End If Next Replace ReplaceText = thechars$ End Function Sub SetBackPre() Call RunMenuByString(AOLWindow(), "Preferences") Do: DoEvents prefer% = FindChildByTitle(AOLMDI(), "Preferences") maillab% = FindChildByTitle(prefer%, "Mail") mailbut% = GetWindow(maillab%, GW_HWNDNEXT) If maillab% <> 0 And mailbut% <> 0 Then Exit Do Loop Pause (0.2) AOLIcon (mailbut%) Do: DoEvents aolmod% = FindWindow("_AOL_Modal", "Mail Preferences") aolcloses% = FindChildByTitle(aolmod%, "Close mail after it has been sent") aolconfirm% = FindChildByTitle(aolmod%, "Confirm mail after it has been sent") aolOK% = FindChildByTitle(aolmod%, "OK") If aolOK% <> 0 And aolcloses% <> 0 And aolconfirm% <> 0 Then Exit Do Loop sendcon% = SendMessage(aolcloses%, BM_SETCHECK, 0, 0) sendcon% = SendMessage(aolconfirm%, BM_SETCHECK, 1, 0) AOLButton (aolOK%) Do: DoEvents aolmod% = FindWindow("_AOL_Modal", "Mail Preferences") Loop Until aolmod% = 0 closepre% = SendMessage(prefer%, WM_CLOSE, 0, 0) End Sub Function StayOnline() hwndz% = FindWindow("_AOL_Palette", "America Online") childhwnd% = FindChildByTitle(hwndz%, "OK") AOLButton (childhwnd%) End Function Function StringToInteger(tochange As String) As Integer StringToInteger = tochange End Function Function TrimCharacter(thetext, chars) TrimCharacter = ReplaceText(thetext, chars, "") End Function Function TrimReturns(thetext) takechr13 = ReplaceText(thetext, Chr$(13), "") takechr10 = ReplaceText(takechr13, Chr$(10), "") TrimReturns = takechr10 End Function Function TrimSpaces(text) If InStr(text, " ") = 0 Then TrimSpaces = text Exit Function End If For TrimSpace = 1 To Len(text) thechar$ = Mid(text, TrimSpace, 1) thechars$ = thechars$ & thechar$ If thechar$ = " " Then thechars$ = Mid(thechars$, 1, Len(thechars$) - 1) End If Next TrimSpace TrimSpaces = thechars$ End Function Function AOLMDI() aol% = FindWindow("AOL Frame25", vbNullString) AOLMDI = FindChildByClass(aol%, "MDIClient") End Function Function UntilWindowClass(parentw, childhand) GoBack: DoEvents firs% = GetWindow(parentw, 5) If UCase(Mid(GetClass(firs%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone firs% = GetWindow(parentw, GW_CHILD) If UCase(Mid(GetClass(firs%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone While firs% firss% = GetWindow(parentw, 5) If UCase(Mid(GetClass(firss%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone firs% = GetWindow(firs%, 2) If UCase(Mid(GetClass(firs%), 1, Len(childhand))) Like UCase(childhand) Then GoTo bone Wend GoTo GoBack FindClassLike = 0 bone: room% = firs% UntilWindowClass = room% End Function Function FindFwdWin(dosloop) 'FindFwdWin = GetParent(FindChildByTitle(FindChildByClass(AOLMDI(), "AOL Child"), "Forward")) 'Exit Function firs% = GetWindow(FindChildByClass(AOLWindow(), "MDIClient"), 5) forw% = FindChildByTitle(firs%, "Forward") If forw% <> 0 Then GoTo bone firs% = GetWindow(FindChildByClass(AOLWindow(), "MDIClient"), GW_CHILD) Do: DoEvents firss% = GetWindow(FindChildByClass(AOLWindow(), "MDIClient"), 5) forw% = FindChildByTitle(firss%, "Forward") If forw% <> 0 Then GoTo begis firs% = GetWindow(firs%, 2) forw% = FindChildByTitle(firs%, "Forward") If forw% <> 0 Then GoTo bone If dosloop = 1 Then Exit Do Loop Exit Function bone: FindFwdWin = firs% Exit Function begis: FindFwdWin = firss% End Function Function FindSendWin(dosloop) firs% = GetWindow(FindChildByClass(AOLWindow(), "MDIClient"), 5) forw% = FindChildByTitle(firs%, "Send Now") If forw% <> 0 Then GoTo bone firs% = GetWindow(FindChildByClass(AOLWindow(), "MDIClient"), GW_CHILD) Do: DoEvents firss% = GetWindow(FindChildByClass(AOLWindow(), "MDIClient"), 5) forw% = FindChildByTitle(firss%, "Send Now") If forw% <> 0 Then GoTo begis firs% = GetWindow(firs%, 2) forw% = FindChildByTitle(firs%, "Send Now") If forw% <> 0 Then GoTo bone If dosloop = 1 Then Exit Do Loop Exit Function bone: FindSendWin = firs% Exit Function begis: FindSendWin = firss% End Function Function UntilWindowTitle(parentw, childhand) GoBac: DoEvents firs% = GetWindow(parentw, 5) If UCase(GetCaption(firs%)) Like UCase(childhand) Then GoTo bone firs% = GetWindow(parentw, GW_CHILD) While firs% firss% = GetWindow(parentw, 5) If UCase(GetCaption(firss%)) Like UCase(childhand) Then GoTo bone firs% = GetWindow(firs%, 2) If UCase(GetCaption(firs%)) Like UCase(childhand) Then GoTo bone Wend GoTo GoBac FindWindowLike = 0 bone: room% = firs% UntilWindowTitle = room% End Function Function KTEncrypt(ByVal password, ByVal strng, force%) 'Example: 'temp = KTEncrypt ("Paszwerd", text1.text, 0) 'text1.text = temp 'Set error capture routine On Local Error GoTo ErrorHandler 'Is there Password?? If Len(password) = 0 Then Error 31100 'Is password too long If Len(password) > 255 Then Error 31100 'Is there a strng$ to work with? If Len(strng) = 0 Then Error 31100 'Check if file is encrypted and not forcing If force% = 0 Then 'Check for encryption ID tag chk$ = Left$(strng, 4) + Right$(strng, 4) If chk$ = Chr$(1) + "KT" + Chr$(1) + Chr$(1) + "KT" + Chr$(1) Then 'Remove ID tag strng = Mid$(strng, 5, Len(strng) - 8) 'String was encrypted so filter out CHR$(1) flags look = 1 Do look = InStr(look, strng, Chr$(1)) If look = 0 Then Exit Do Else Addin$ = Chr$(Asc(Mid$(strng, look + 1)) - 1) strng = Left$(strng, look - 1) + Addin$ + Mid$(strng, look + 2) End If look = look + 1 Loop 'Since it is encrypted we want to decrypt it EncryptFlag% = False Else 'Tag not found so flag to encrypt string EncryptFlag% = True End If Else 'force% flag set, ecrypt string regardless of tag EncryptFlag% = True End If 'Set up variables PassUp = 1 PassMax = Len(password) 'Tack on leading characters to prevent repetative recognition password = Chr$(Asc(Left$(password, 1)) Xor PassMax) + password password = Chr$(Asc(Mid$(password, 1, 1)) Xor Asc(Mid$(password, 2, 1))) + password password = password + Chr$(Asc(Right$(password, 1)) Xor PassMax) password = password + Chr$(Asc(Right$(password, 2)) Xor Asc(Right$(password, 1))) 'If Encrypting add password check tag now so it is encrypted with string If EncryptFlag% = True Then strng = Left$(password, 3) + Format$(Asc(Right$(password, 1)), "000") + Format$(Len(password), "000") + strng End If 'Loop until scanned though the whole string For Looper = 1 To Len(strng) DoEvents 'Alter character code tochange = Asc(Mid$(strng, Looper, 1)) Xor Asc(Mid$(password, PassUp, 1)) 'Insert altered character code Mid$(strng, Looper, 1) = Chr$(tochange) 'Scroll through password string one character at a time PassUp = PassUp + 1 If PassUp > PassMax + 4 Then PassUp = 1 Next Looper 'If encrypting we need to filter out all bad character codes (0, 10, 13, 26) If EncryptFlag% = True Then 'First get rid of all CHR$(1) since that is what we use for our flag look = 1 Do look = InStr(look, strng, Chr$(1)) If look > 0 Then strng = Left$(strng, look - 1) + Chr$(1) + Chr$(2) + Mid$(strng, look + 1) look = look + 1 End If Loop While look > 0 'Check for CHR$(0) Do look = InStr(strng, Chr$(0)) If look > 0 Then strng = Left$(strng, look - 1) + Chr$(1) + Chr$(1) + Mid$(strng, look + 1) Loop While look > 0 'Check for CHR$(10) Do look = InStr(strng, Chr$(10)) If look > 0 Then strng = Left$(strng, look - 1) + Chr$(1) + Chr$(11) + Mid$(strng, look + 1) Loop While look > 0 'Check for CHR$(13) Do look = InStr(strng, Chr$(13)) If look > 0 Then strng = Left$(strng, look - 1) + Chr$(1) + Chr$(14) + Mid$(strng, look + 1) Loop While look > 0 'Check for CHR$(26) Do look = InStr(strng, Chr$(26)) If look > 0 Then strng = Left$(strng, look - 1) + Chr$(1) + Chr$(27) + Mid$(strng, look + 1) Loop While look > 0 'Tack on encryted tag strng = Chr$(1) + "KT" + Chr$(1) + strng + Chr$(1) + "KT" + Chr$(1) Else 'We decrypted so ensure password used was the correct one If Left$(strng, 9) <> Left$(password, 3) + Format$(Asc(Right$(password, 1)), "000") + Format$(Len(password), "000") Then 'Password bad cause error Error 31100 Else 'Password good, remove password check tag strng = Mid$(strng, 10) End If End If 'Set function equal to modified string KTEncrypt = strng 'Were out of here Exit Function ErrorHandler: 'We had an error! Were out of here Exit Function End Function Public Sub CenterForm(frmForm As Form) With frmForm .Left = (Screen.Width - .Width) / 2 .Top = (Screen.Height - .Height) / 2 End With End Sub Public Function GetChildCount(ByVal hwnd As Long) As Long Dim hChild As Long Dim i As Integer If hwnd = 0 Then GoTo Return_False End If hChild = GetWindow(hwnd, GW_CHILD) While hChild hChild = GetWindow(hChild, GW_HWNDNEXT) i = i + 1 Wend GetChildCount = i Exit Function Return_False: GetChildCount = 0 Exit Function End Function Public Sub AOLButton(but%) clickicon% = SendMessage(but%, WM_KEYDOWN, VK_SPACE, 0) clickicon% = SendMessage(but%, WM_KEYUP, VK_SPACE, 0) End Sub Function AOLGetUser() On Error Resume Next aol% = FindWindow("AOL Frame25", "America Online") mdi% = FindChildByClass(aol%, "MDIClient") Welcome% = FindChildByTitle(mdi%, "Welcome, ") WelcomeLength% = GetWindowTextLength(Welcome%) WelcomeTitle$ = String$(200, 0) a% = GetWindowText(Welcome%, WelcomeTitle$, (WelcomeLength% + 1)) User = Mid$(WelcomeTitle$, 10, (InStr(WelcomeTitle$, "!") - 10)) AOLGetUser = User End Function Sub AOLIMOff() Call AOLInstantMessage("$IM_OFF", "Turn off!") End Sub Sub AOLIMsOn() Call AOLInstantMessage("$IM_ON", "Turn on!") End Sub Sub AOLChatSend(Txt) room% = AOLFindRoom() Call AOLSetText(FindChildByClass(room%, "_AOL_Edit"), Txt) DoEvents Call SendCharNum(FindChildByClass(room%, "_AOL_Edit"), 13) End Sub Sub AOLClose(winew) closes = SendMessage(winew, WM_CLOSE, 0, 0) End Sub Sub AOLCursor() Call RunMenuByString(AOLWindow(), "&About America Online") Do: DoEvents Loop Until FindWindow("_AOL_Modal", vbNullString) SendMessage FindWindow("_AOL_Modal", vbNullString), WM_CLOSE, 0, 0 End Sub Function AOLFindRoom() aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") firs% = GetWindow(mdi%, 5) listers% = FindChildByClass(firs%, "_AOL_Edit") listere% = FindChildByClass(firs%, "_AOL_View") listerb% = FindChildByClass(firs%, "_AOL_Listbox") If listers% And listere% And listerb% Then GoTo bone firs% = GetWindow(mdi%, GW_CHILD) While firs% firs% = GetWindow(firs%, 2) listers% = FindChildByClass(firs%, "_AOL_Edit") listere% = FindChildByClass(firs%, "_AOL_View") listerb% = FindChildByClass(firs%, "_AOL_Listbox") If listers% And listere% And listerb% Then GoTo bone aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") firs% = GetWindow(mdi%, 5) listers% = FindChildByClass(firs%, "_AOL_Edit") listere% = FindChildByClass(firs%, "_AOL_View") listerb% = FindChildByClass(firs%, "_AOL_Listbox") If listers% And listere% And listerb% Then GoTo bone Wend bone: room% = firs% AOLFindRoom = room% End Function Function AOLGetChat() childs% = AOLFindRoom() child = FindChildByClass(childs%, "_AOL_View") GetTrim = SendMessageByNum(child, 14, 0&, 0&) TrimSpace$ = Space$(GetTrim) GetString = SendMessageByString(child, 13, GetTrim + 1, TrimSpace$) theview$ = TrimSpace$ AOLGetChat = theview$ End Function Function AOLGetText(child) GetTrim = SendMessageByNum(child, 14, 0&, 0&) TrimSpace$ = Space$(GetTrim) GetString = SendMessageByString(child, 13, GetTrim + 1, TrimSpace$) AOLGetText = TrimSpace$ End Function Sub AOLIcon(icon%) Click% = SendMessage(icon%, WM_LBUTTONDOWN, 0, 0&) Click% = SendMessage(icon%, WM_LBUTTONUP, 0, 0&) End Sub Sub AOLInstantMessage(Person, message) Call RunMenuByString(AOLWindow(), "Send an Instant Message") Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") IM% = FindChildByTitle(mdi%, "Send Instant Message") aoledit% = FindChildByClass(IM%, "_AOL_Edit") aolrich% = FindChildByClass(IM%, "RICHCNTL") imsend% = FindChildByClass(IM%, "_AOL_Icon") If aoledit% <> 0 And aolrich% <> 0 And imsend% <> 0 Then Exit Do Loop Call AOLSetText(aoledit%, Person) Call AOLSetText(aolrich%, message) imsend% = FindChildByClass(IM%, "_AOL_Icon") For sends = 1 To 9 imsend% = GetWindow(imsend%, 2) Next sends AOLIcon (imsend%) Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") IM% = FindChildByTitle(mdi%, "Send Instant Message") aolcl% = FindWindow("#32770", "America Online") If aolcl% <> 0 Then closer = SendMessage(aolcl%, WM_CLOSE, 0, 0): closer2 = SendMessage(IM%, WM_CLOSE, 0, 0): Exit Do If IM% = 0 Then Exit Do Loop End Sub Function AOLIsOnline() aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") Welcome% = FindChildByTitle(mdi%, "Welcome, ") If Welcome% = 0 Then MsgBox "Please sign on before using this feature.", 64, "Online" AOLIsOnline = 0 Exit Function End If AOLIsOnline = 1 End Function Sub AOLKeyword(text) Call RunMenuByString(AOLWindow(), "Keyword...") Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") keyw% = FindChildByTitle(mdi%, "Keyword") kedit% = FindChildByClass(keyw%, "_AOL_Edit") If kedit% Then Exit Do Loop editsend% = SendMessageByString(kedit%, WM_SETTEXT, 0, text) pausing = DoEvents() Sending% = SendMessage(kedit%, 258, 13, 0) pausing = DoEvents() End Sub Function AOLLastChatLine() getpar% = AOLFindRoom() child = FindChildByClass(getpar%, "_AOL_View") GetTrim = SendMessageByNum(child, 14, 0&, 0&) TrimSpace$ = Space$(GetTrim) GetString = SendMessageByString(child, 13, GetTrim + 1, TrimSpace$) theview$ = TrimSpace$ For FindChar = 1 To Len(theview$) thechar$ = Mid(theview$, FindChar, 1) thechars$ = thechars$ & thechar$ If thechar$ = Chr(13) Then thechatext$ = Mid(thechars$, 1, Len(thechars$) - 1) thechars$ = "" End If Next FindChar lastlen = Val(FindChar) - Len(thechars$) lastline = Mid(theview$, lastlen + 1, Len(thechars$) - 1) AOLLastChatLine = lastline End Function Sub AOLMail(Person, subject, message) Call RunMenuByString(AOLWindow(), "Compose Mail") Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") mailwin% = FindChildByTitle(mdi%, "Compose Mail") icone% = FindChildByClass(mailwin%, "_AOL_Icon") peepz% = FindChildByClass(mailwin%, "_AOL_Edit") subjt% = FindChildByTitle(mailwin%, "Subject:") subjec% = GetWindow(subjt%, 2) mess% = FindChildByClass(mailwin%, "RICHCNTL") If icone% <> 0 And peepz% <> 0 And subjec% <> 0 And mess% <> 0 Then Exit Do Loop a = SendMessageByString(peepz%, WM_SETTEXT, 0, Person) a = SendMessageByString(subjec%, WM_SETTEXT, 0, subject) a = SendMessageByString(mess%, WM_SETTEXT, 0, message) AOLIcon (icone%) Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") mailwin% = FindChildByTitle(mdi%, "Compose Mail") erro% = FindChildByTitle(mdi%, "Error") aolw% = FindWindow("_AOL_Modal", vbNullString) If mailwin% = 0 Then Exit Do If aolw% <> 0 Then 'a = SendMessage(aolw%, WM_CLOSE, 0, 0) AOLButton (FindChildByTitle(aolw%, "OK")) a = SendMessage(mailwin%, WM_CLOSE, 0, 0) Exit Sub End If If erro% <> 0 Then a = SendMessage(erro%, WM_CLOSE, 0, 0) a = SendMessage(mailwin%, WM_CLOSE, 0, 0) Exit Do End If Loop End Sub Sub AOLMainMenu() Call RunMenu(2, 3) End Sub Function AOLRoomCount() thechild% = AOLFindRoom() lister% = FindChildByClass(thechild%, "_AOL_Listbox") getcount = SendMessage(lister%, LB_GETCOUNT, 0, 0) AOLRoomCount = getcount End Function Sub AOLSetText(win, Txt) thetext% = SendMessageByString(win, WM_SETTEXT, 0, Txt) End Sub Sub AOLSignOff() aol% = FindWindow("AOL Frame25", vbNullString) If aol% = 0 Then MsgBox "AOL client error: Please open Windows America Online before continuing.", 64, "Error: Windows America Online": Exit Sub Call RunMenu(2, 0) Exit Sub 'ignore since of new aol.... Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) pfc% = FindChildByTitle(aol%, "Sign Off?") If pfc% <> 0 Then icon1% = FindChildByClass(pfc%, "_AOL_Icon") icon1% = GetWindow(icon1%, 2) icon1% = GetWindow(icon1%, 2) icon1% = GetWindow(icon1%, 2) icon1% = GetWindow(icon1%, 2) icon1% = GetWindow(icon1%, 2) clickicon% = SendMessage(icon1%, WM_LBUTTONDOWN, 0, 0&) clickicon% = SendMessage(icon1%, WM_LBUTTONUP, 0, 0&) Exit Do End If Loop End Sub Function AOLVersion() aol% = FindWindow("AOL Frame25", vbNullString) hMenu% = GetMenu(aol%) submenu% = GetSubMenu(hMenu%, 0) subitem% = GetMenuItemID(submenu%, 8) MenuString$ = String$(100, " ") FindString% = GetMenuString(submenu%, subitem%, MenuString$, 100, 1) If UCase(MenuString$) Like UCase("P&ersonal Filing Cabinet") & "*" Then AOLVersion = 3 Else AOLVersion = 2.5 End If End Function Function AOLWindow() aol% = FindWindow("AOL Frame25", vbNullString) AOLWindow = aol% End Function Function GetCaption(hwnd) hwndLength% = GetWindowTextLength(hwnd) hwndTitle$ = String$(hwndLength%, 0) a% = GetWindowText(hwnd, hwndTitle$, (hwndLength% + 1)) GetCaption = hwndTitle$ End Function Function GetClass(child) buffer$ = String$(250, 0) getclas% = GetClassName(child, buffer$, 250) GetClass = buffer$ End Function Function GetWindowDir() buffer$ = String$(255, 0) X = GetWindowsDirectory(buffer$, 255) If Right$(buffer$, 1) <> "\" Then buffer$ = buffer$ + "\" GetWindowDir = buffer$ End Function Sub NotOnTop(the As Form) SetWinOnTop = SetWindowPos(the.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS) End Sub Sub Pause(interval) Current = Timer Do While Timer - Current < Val(interval) DoEvents Loop End Sub Sub SendCharNum(win, chars) e = SendMessageByNum(win, WM_CHAR, chars, 0) End Sub Function SetChildFocus(child) setchild% = SetFocusAPI(child) End Function Sub SetPreference() Call RunMenuByString(AOLWindow(), "Preferences") Do: DoEvents prefer% = FindChildByTitle(AOLMDI(), "Preferences") maillab% = FindChildByTitle(prefer%, "Mail") mailbut% = GetWindow(maillab%, GW_HWNDNEXT) If maillab% <> 0 And mailbut% <> 0 Then Exit Do Loop Pause (0.2) AOLIcon (mailbut%) Do: DoEvents aolmod% = FindWindow("_AOL_Modal", "Mail Preferences") aolcloses% = FindChildByTitle(aolmod%, "Close mail after it has been sent") aolconfirm% = FindChildByTitle(aolmod%, "Confirm mail after it has been sent") aolOK% = FindChildByTitle(aolmod%, "OK") If aolOK% <> 0 And aolcloses% <> 0 And aolconfirm% <> 0 Then Exit Do Loop sendcon% = SendMessage(aolcloses%, BM_SETCHECK, 1, 0) sendcon% = SendMessage(aolconfirm%, BM_SETCHECK, 0, 0) AOLButton (aolOK%) Do: DoEvents aolmod% = FindWindow("_AOL_Modal", "Mail Preferences") Loop Until aolmod% = 0 closepre% = SendMessage(prefer%, WM_CLOSE, 0, 0) End Sub Sub StayOnTop(the As Form) SetWinOnTop = SetWindowPos(the.hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) End Sub Sub RunMenu(menu1 As Integer, menu2 As Integer) Dim AOLWorks As Long Static Working As Integer AOLMenus% = GetMenu(FindWindow("AOL Frame25", vbNullString)) AOLSubMenu% = GetSubMenu(AOLMenus%, menu1) AOLItemID = GetMenuItemID(AOLSubMenu%, menu2) AOLWorks = CLng(0) * &H10000 Or Working ClickAOLMenu = SendMessageByNum(FindWindow("AOL Frame25", vbNullString), 273, AOLItemID, 0&) End Sub Sub WaitWindow() aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") topmdi% = GetWindow(mdi%, 5) Do: DoEvents aol% = FindWindow("AOL Frame25", vbNullString) mdi% = FindChildByClass(aol%, "MDIClient") topmdi2% = GetWindow(mdi%, 5) If Not topmdi2% = topmdi% Then Exit Do Loop End Sub Function FreeProcess() Do: DoEvents Process = Process + 1 If Process = 50 Then Exit Do Loop 'frees process of freezes in your program 'and other stuff that makes your program 'slow down. Works great. End Function