|
-
Jan 17th, 2001, 11:20 AM
#1
Thread Starter
Frenzied Member
How can you interact with other applications? for example.. if I wanted to create an autoresponder for all messages I receive, how would I do that? Anyone know?
-
Jan 17th, 2001, 11:30 AM
#2
Frenzied Member
Download my WindowHandler class:
http://www.geocities.com/despotez/WH/
I have an example on sending messages to the first person on your list. If you doubleclick a person, you'll get the message, and when a person sends a message, the message will be on top.
I think you'll be able to work it out with the caption property to set & get the text from the textbox.
But... there's a ICQ API too!
http://www.icq.com/api/
That'll make life easier!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Jan 17th, 2001, 11:33 AM
#3
Thread Starter
Frenzied Member
thanks Jop! one prblem though, my firewall at school blocked out the geocities domain so i cant access it.. is there another server that its on?
-
Jan 17th, 2001, 11:34 AM
#4
Thread Starter
Frenzied Member
also, can u please provide a direct link to download the api for ICQ? Looks like the proxy blocked that too..
-
Jan 17th, 2001, 11:41 AM
#5
Frenzied Member
I can't give you the direct-download link because you have to fill in stuff:
http://www.icq.com/api/downloadapi.html
Here's my WindowHandler class:
In a class:
Code:
' ********Jop's WindowHandler Class*********
' ********geocities.com/despotez/WH*********
' ********Special thanks to KEDAMAN*********
' ******** -(www.kedaman.com)- *********
'LEGAL STUFF:
'You are allowed to use it in personal & commercial
'programs as long as you:
' - Leave this header unmodified in the class.
' - Don't use it for any malicious (Illegal) actions.
' - And... Ah well, just enjoy it :)
' - Please email me if you like it or not.
'To get full advantage of this class use the module.
'To get some examples use the Example.frm
'Here are the Properties and Functions, and what they do.
'Dim win As New WindowHandler < use this to initialize the class
'AlwaysOnTop > Sets the specified window (by hWnd) always on top or not.
'Caption > Sets or gets the caption of a specified window or control (by hWnd).
'Click > Click the specified window (by hWnd) at a specified point.
'CloseWindow > Closes the specified window (by hWnd).
'Enabled > Enable or Disable the specified window (by hWnd) or get it's status.
'FindWin > This gets the hWnd of a window by it's caption or classname.
'FindWinEx > This gets the hWnd of any child window or control by it's caption or classname.
'FlashWin > This flashes the specified window by a specified time.
'GetAllWindows > This gets all open windows in an array (pass it a variant).
'GetMetrics > This gets the Rectangle of the window (top, left, right, bottom) in a RECT.
'GetMousePos > This gets the coordinates of the mousecursor in a POINTAPI.
'GetWinProperties > This gets the properties (left, top, width, height, classname, caption) from a window (by hWnd).
'GetWndClassName > This gets the classname from a window or control.
'MouseDown > This pushes down (and hold) the specified mousebutton on the point where the mouse is.
'MouseUp > This triggers the MouseUp event to release the MouseDown (MouseDown + MouseUp = Click)
'Move > This is used to move and/or resize a window or control.
'Redraw > This is used to Redraw (refresh) a specified window (it triggers the PAINT method for that form)
'SetFocus > This sets the focus (it's sets it to the foreground) to a specified window (by hWnd).
'SetMousePos > This sets the mousecursor to the specified coordinates.
'ShowMouse > This shows or hides the mousecursor.
'SwapMouse > This Swaps the mousebuttons or restores them.
'Visible > This makes the window visible/invisible or checks the state (visible or invisible).
'WinFromPoint > This gets the hWnd of the window or control currently under the mousepointer.
'Api calls
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
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 SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
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 Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Sub 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)
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private 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
Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SwapMouseButton Lib "user32" (ByVal bSwap As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As Any, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
'Enums
'Types
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type POINTAPI
x As Long
y As Long
End Type
'Constants
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_MOVE = &H1
Private Const MOUSEEVENTF_ABSOLUTE = &H8000
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Private Const SC_CLOSE = &HF060
Private Const SC_CONTEXTHELP = &HF180
Private Const SC_MAXIMIZE = &HF030
Private Const SC_MINIMIZE = &HF020
Private Const SC_MOVE = &HF010
Private Const SC_RESTORE = &HF120
Private Const SC_SIZE = &HF000
Private Const MK_CONTROL = &H8
Private Const MK_LBUTTON = &H1
Private Const MK_MBUTTON = &H10
Private Const MK_RBUTTON = &H2
Private Const MK_SHIFT = &H4
Private Const MK_XBUTTON1 = &H20
Private Const MK_XBUTTON2 = &H40
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_SYSCOMMAND = &H112
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_ACTIVATEAPP = &H1C
Private Const WM_ACTIVATE = &H6
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const RDW_INVALIDATE = &H1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDNEXT = 2
Function GetAllWindows(starthwnd&)
'THANKS TO KEDAMAN
'For alot more cool stuff see http://www.kedaman.com!
Dim cw&(), currwnd&: ReDim cw(0)
currwnd = GetWindow(starthwnd, GW_HWNDFIRST)
While currwnd <> 0
cw(UBound(cw)) = currwnd
ReDim Preserve cw(UBound(cw) + 1)
currwnd = GetWindow(currwnd, GW_HWNDNEXT)
DoEvents
Wend
If UBound(cw) Then ReDim Preserve cw(UBound(cw) - 1) Else Exit Function
GetAllWindows = cw
End Function
Public Function FindWin(Class As String, Caption As String) As Long
Dim x As Long
If Class = "" Then Class = vbNullString
If Caption = "" Then Caption = vbNullString
FindWin = FindWindow(Class, Caption)
End Function
Public Function FindWinEx(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal param1 As String, ByVal param2 As String) As Long
FindWinEx = FindWindowEx(hWnd1, hWnd2, param1, param2)
End Function
Public Property Let Visible(WinhWnd As Long, flag As Boolean)
ShowWindow WinhWnd, -flag * 5
End Property
Public Property Get Visible(WinhWnd As Long) As Boolean
Visible = -(IsWindowVisible(WinhWnd))
End Property
Public Property Let Caption(WinhWnd As Long, Caption As String)
SendMessage WinhWnd, WM_SETTEXT, ByVal CLng(0), ByVal Caption
End Property
Public Property Get Caption(WinhWnd As Long) As String
Dim l%, Wintext$, retval&
l = SendMessage(WinhWnd, WM_GETTEXTLENGTH, ByVal CLng(0), ByVal CLng(0)) + 1
Wintext = Space(l)
retval = SendMessage(WinhWnd, WM_GETTEXT, ByVal l, ByVal Wintext)
Wintext = Left(Wintext, retval)
Caption = Wintext
End Property
Public Function CloseWindow(WinhWnd As Long)
SendMessage WinhWnd, WM_SYSCOMMAND, ByVal SC_CLOSE, ByVal 0&
End Function
Public Function SetFocus(WinhWnd As Long)
SetForegroundWindow WinhWnd
End Function
Public Property Let AlwaysOnTop(WinhWnd As Long, flag As Boolean)
SetWindowPos WinhWnd, -2 - flag, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Property
Friend Function GetMetrics(WinhWnd As Long) As RECT
Dim win As RECT
GetWindowRect WinhWnd, win
GetMetrics = win
End Function
Public Function Move(WinhWnd As Long, x As Long, y As Long, Optional Width As Long, Optional Height As Long)
Dim win As RECT
GetWindowRect WinhWnd, win
If Width = 0 Then Width = win.Right - win.Left
If Height = 0 Then Height = win.Bottom - win.Top
MoveWindow WinhWnd, x, y, Width, Height, 1
End Function
Public Sub FlashWin(WinhWnd As Long, Time As Integer)
Dim x&, i%
For i = 0 To Time * 2
For x = 0 To 5000
DoEvents
Next x
FlashWindow WinhWnd, 1
Next i
End Sub
Public Sub Click(WinhWnd As Long, x As Long, y As Long, Optional Left As Boolean = True, Optional Right As Boolean, Optional Middle As Boolean, Optional DoubleClick As Boolean = False)
Dim i%
If DoubleClick Then
MouseDown Left, Right, Middle, True, True, x, y
MouseDown Left, Right, Middle, True, True, x, y
Else
MouseDown Left, Right, Middle, True, True, x, y
End If
End Sub
Public Sub SetMousePos(x As Long, y As Long)
SetCursorPos x, y
End Sub
Friend Function GetMousePos() As POINTAPI
Dim pnt As POINTAPI
GetCursorPos pnt
GetMousePos = pnt
End Function
Public Sub MouseDown(Optional Left As Boolean = True, Optional Right As Boolean, Optional Middle As Boolean, Optional Click As Boolean, Optional MoveToPoint As Boolean, Optional x As Long, Optional y As Long)
'Thanks to Kedaman for this:
If MoveToPoint Then SetCursorPos x, y
mouse_event -Left * 2 - Right * 8 - Middle * 32, 0, 0, 0&, 0&
If Click Then mouse_event -Left * 4 - Right * 16 - Middle * 64, 0&, 0&, 0&, 0&
End Sub
Public Sub MouseUp(Optional Left As Boolean = True, Optional Right As Boolean, Optional Middle As Boolean, Optional MoveToPoint As Boolean, Optional x As Long, Optional y As Long)
'Thanks to Kedaman for this:
If MoveToPoint Then SetCursorPos x, y
mouse_event -Left * 4 - Right * 16 - Middle * 64, 0, 0, 0&, 0&
End Sub
Public Function WinFromPoint(x, y) As Long
WinFromPoint = WindowFromPoint(x, y)
End Function
Public Property Let Enabled(WinhWnd As Long, Enable As Boolean)
EnableWindow WinhWnd, -Enable
End Property
Public Property Get Enabled(WinhWnd As Long) As Boolean
Enabled = -(IsWindowEnabled(WinhWnd))
End Property
Public Sub SwapMouse(Swap As Boolean)
SwapMouseButton -Swap
End Sub
Public Sub ShowMouse(Show As Boolean)
ShowCursor -Show
End Sub
Public Sub Redraw(WinhWnd)
RedrawWindow WinhWnd, ByVal 0&, ByVal 0&, RDW_INVALIDATE
End Sub
Public Function GetWndClassName(WinhWnd)
'Thanks Keda!
Dim temp As String * 255, l As Long
l = GetClassName(WinhWnd, temp, 255)
If l Then GetWndClassName = Left$(temp, l)
End Function
Friend Function GetWinProperties(Handle As Long) As wnd
'This is just a function to get all the properties of a window at once.
Dim wind As wnd, win As New WindowHandler, Rct As RECT
wind.Caption = win.Caption(Handle)
wind.ClassName = win.GetWndClassName(Handle)
Rct = win.GetMetrics(Handle)
wind.Left = Rct.Left
wind.Top = Rct.Top
wind.Width = Rct.Right - Rct.Left
wind.Height = Rct.Bottom - Rct.Top
GetWinProperties = wind
End Function
In a module:
Code:
'This module is part of Jop's WindowHandler class.
'Most of the code in this module is written by Kedaman.
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Type POINTAPI
x As Long
y As Long
End Type
Public Type wnd
ClassName As String
Caption As String
Left As Long
Top As Long
Width As Long
Height As Long
End Type
'Constants
Public Const WM_SETTEXT = &HC
Private Const EM_SETPASSWORDCHAR = &HCC
'API calls
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
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private returnval(), counter%, Parent&
Private Function EnumFunction(ByVal hwnd&, ByVal lParam&) As Long
'SPECIAL THANX TO UNCLE KEDAMAN FOR THIS CODE!
If GetParent(hwnd) <> Parent Then EnumFunction = True: Exit Function 'Exits if it's a indirect child
counter = counter + 1
ReDim Preserve returnval(counter - 1)
returnval(counter - 1) = hwnd
EnumFunction = True
End Function
Public Function Getchild(Parenthwnd&)
'SPECIAL THANX TO UNCLE KEDAMAN FOR THIS CODE!
Parent = Parenthwnd
counter = 0
EnumChildWindows Parenthwnd, AddressOf EnumFunction, 0
If counter Then Getchild = returnval
End Function
In a form (the examples)
Code:
Option Explicit
'WindowHandler Demo's by Jop, Special thanx to Kedaman
'for supporting me writing this class.
'Use all these examples and the class at your own risk.
'I'm not responsible for any damage or something.
'Visit http://www.geocities.com/despotez/WH for latest
'versions and more info and examples.
'There are alot better programs out there that
'do the same tricks but these are just to show
'how to use the class.
'In order to view this demo be sure to add the class and the module to your project
'Variables
Private Cncel As Boolean
Private Function GetIEurl()
'This get's the URL of the active IE window.
'You could throw it in a loop if you need to get all windows.
Dim win As New WindowHandler, wind As RECT, i&, w&, r&, c&, c2&, e&
i = win.FindWin("IEFrame", "")
w = win.FindWinEx(i, ByVal 0&, "WorkerA", "")
r = win.FindWinEx(w, ByVal 0&, "ReBarWindow32", "")
c = win.FindWinEx(r, ByVal 0&, "ComboBoxEx32", "")
c2 = win.FindWinEx(c, ByVal 0&, "ComboBox", "")
e = win.FindWinEx(c2, ByVal 0&, "Edit", "")
GetIEurl = win.Caption(e)
End Function
Private Sub SetIEurl(url As String)
'This sets the specified URL in the IE box and presses enter.
'I know there's shellexecute but this is just to show what it's capable of ;)
Dim win As New WindowHandler, wind As RECT, i&, w&, r&, c&, c2&, e&
i = win.FindWin("IEFrame", "")
w = win.FindWinEx(i, ByVal 0&, "WorkerA", "")
r = win.FindWinEx(w, ByVal 0&, "ReBarWindow32", "")
c = win.FindWinEx(r, ByVal 0&, "ComboBoxEx32", "")
c2 = win.FindWinEx(c, ByVal 0&, "ComboBox", "")
e = win.FindWinEx(c2, ByVal 0&, "Edit", "")
win.SetFocus e
win.Caption(e) = url
SendKeys "{Enter}", True
End Sub
Private Sub ICQSendMessage(UIN As String, Message As String)
'This sends a message (just by clicking) to the first person on your list.
'UIN is YOUR UIN, just to find the ICQ window, you can also hide the window if you want.
'I know you have the api for sending messages, but again, this is just to show what you can do.
Dim win As New WindowHandler, wind As RECT, h&, e&, b&, z&, x&, i%
h = win.FindWin("", UIN)
wind = win.GetMetrics(h)
win.Click h, wind.Left + 10, wind.Top + 70, True, False, False, True
Do While e = 0 And i < 100
i = i + 1
e = win.FindWin("", "Send Online Message")
If e = 0 Then e = win.FindWin("", "Send Online Message [User Is Away]")
If e = 0 Then e = win.FindWin("", "Send Online Message [User Is in N/A mode]")
'Add this for all modes and it always works.
Loop
b = win.FindWinEx(e, ByVal 0&, "RICHEDIT", "")
z = win.FindWinEx(e, ByVal 0&, "Button", "&Send")
wind = win.GetMetrics(z)
SendKeys Message, True
win.Click z, wind.Left + 20, wind.Top + 20, True, False, False, False
End Sub
Private Sub ICQSearch(UIN As String, ToSearchFor As String)
'This adds something to the ICQ search-box, and clicks the GO button
'UIN is YOUR UIN just to find the ICQ window.
'Yeah Yeah I know we have altavista :)
Dim win As New WindowHandler, wind As RECT, e&, i&, b&, z&, x&
i = win.FindWin("", UIN)
e = win.FindWinEx(i, ByVal 0&, "Edit", "")
SendMessage e, WM_SETTEXT, ByVal CLng(0), ByVal ToSearchFor
b = win.FindWinEx(i, ByVal 0&, "Button", "")
b = win.FindWinEx(i, b, "Button", "")
wind = win.GetMetrics(b)
win.Click b, wind.Left, wind.Top, True
End Sub
Private Sub Winzip()
'This is one of the weakest demo's, it does nothing but
'pressing the Winzip new button (only in classic mode).
Dim win As New WindowHandler, wind As RECT, w&, r&, t&, e&
w = win.FindWin("WinZipWClass", "")
r = win.FindWinEx(w, ByVal 0&, "ReBarWindow32", "")
t = win.FindWinEx(r, ByVal 0&, "ToolBarWindow32", "")
win.SetFocus t
wind = win.GetMetrics(t)
win.Click t, wind.Left, wind.Top, True
End Sub
Private Sub Paint()
'This is an example how to draw a line from a to b in paint :)
'It seems useless but it may be of use anytime!
Dim win As New WindowHandler, wind As RECT, p&, a2&, a&, x&, l&, t&
p = win.FindWin("MSPaintApp", "")
a2 = win.FindWinEx(p, ByVal 0&, "AfxFrameOrView42", "")
a = win.FindWinEx(a2, ByVal 0&, "Afx:1000000:8", "")
If a = 0 Then Exit Sub
win.SetFocus a
wind = win.GetMetrics(a)
l = wind.Left + 100
t = wind.Top + 100
For x = 0 To 300
win.Click a, l + x, t, True
DoEvents
Next
End Sub
Private Sub MouseMove()
'This just moves the mouse... nothing fancy :)
'But it could get cool sometimes just to make people
'believe you're moving your mouse and click something.
Dim win As New WindowHandler, pnt As POINTAPI, x%
pnt = win.GetMousePos
x = 0
Do While x < 200
x = x + 0.6
win.SetMousePos pnt.x + x, pnt.y + x
DoEvents
Loop
win.MouseDown False, True 'MouseUp after a MouseDown = Click
win.MouseUp False, True
End Sub
Private Sub DragDrop(UIN As String)
'This drags & drop a contact from your ICQ list to this form.
'It doesn't do anything yet, but you can use it to
'drag&drop almost anything to anywhere ;)
Me.OLEDropMode = 1 'to accept dropping on this form
Dim win As New WindowHandler, w As RECT, pnt As POINTAPI, i&
i = win.FindWin("", UIN)
w = win.GetMetrics(i)
win.MouseDown True, False, False, False, True, w.Left + 20, w.Top + 70
w = win.GetMetrics(Me.hwnd)
'win.SetFocus (Me.hwnd)
win.SetMousePos w.Left + 40, w.Top + 40
win.MouseUp True
End Sub
Private Sub XWindows()
'THIS IS SOOO COOL :)
'This mimics the XWindows feature when you move
'you're mouse above a window, it get's focus.
'This does the same thing, but I warn you:
'it's kinda buggy so you have to improve it if
'you want to use it :)
Dim win As New WindowHandler, pnt As POINTAPI, w&
Do While Cncel = False
pnt = win.GetMousePos
w = win.WinFromPoint(pnt.x, pnt.y)
win.SetFocus (w)
DoEvents
Loop
End Sub
Private Function TextFromMousePoint() As String
'This one is almost the same as the above one
'but this one gets the caption of the window,
'textbox, label, ah well, everything with a caption.
Dim win As New WindowHandler, pnt As POINTAPI, w&
Do While Cncel = False
pnt = win.GetMousePos
w = win.WinFromPoint(pnt.x, pnt.y)
DoEvents
Text1.Text = win.Caption(w)
Loop
End Function
Private Function DisableICQ(UIN As String)
'This function disables ICQ window for a few secs.
'Nothing cool, but you can use it for almost anything
'(textboxes, buttons and more)
'Oh, don't forget you can enable things too :) very handy
'when a program vendor (trial) has disabled some functions :)
Dim win As New WindowHandler, i&, ic&, il&, l&, x&
i = win.FindWin("", UIN)
ic = win.FindWinEx(i, ByVal 0&, "ICQ Contact List Window", "")
il = win.FindWinEx(ic, ByVal 0&, "ICQ Lists Window", "")
l = win.FindWinEx(il, ByVal 0&, "ListBox", "")
win.Enabled(l) = False
For x = 0 To 90000 'this is just to "wait"
DoEvents
Next
win.Enabled(l) = True
End Function
Private Sub Swap()
'This swaps the mousebutton for a few secs
'just to confuse the user, use it wisely ;)
Dim win As New WindowHandler, x&
win.SwapMouse True
For x = 0 To 90000 'this is just to "wait"
DoEvents
Next
win.SwapMouse False
End Sub
Private Sub HideMouse()
'This hides the mouse (only on this form?) for a few secs.
'Use it wisely ;)
Dim win As New WindowHandler, x&
win.ShowMouse False
For x = 0 To 90000 'this is just to "wait"
DoEvents
Next
win.ShowMouse True
End Sub
Private Sub ICQSetPassChar(UIN As String, PassChar As String)
'This SETS the ICQ Search window's password and REPAINT it.
'Set it to "" to disable the password char.
'I know this is of no use, but you can use it at
'any edit control, even password fields hehe :)
'UIN = YOUR UIN, just to find the window
'Use it wisely
Dim win As New WindowHandler, wind As RECT, e&, i&, char As Long
i = win.FindWin("", UIN)
e = win.FindWinEx(i, ByVal 0&, "Edit", "")
If PassChar <> "" Then
char = CLng(Asc(PassChar))
Else
char = 0
End If
SendMessage e, EM_SETPASSWORDCHAR, ByVal char, ByVal 0&
win.Redraw e
'Just to show putting the passchar doesn't affect
'the actual contents uncomment the line below:
'MsgBox win.Caption(e)
End Sub
Private Sub APIViewerButtons()
'This'll get all buttons from the API viewer and changes their captions.
'This demo is meant only for VB5 I think, replace all the 5's with 6's
'in order to work with VB6.
Dim win As New WindowHandler, arr As Variant, t&, x&, i&, wnd As wnd
i = win.FindWin("ThunderRT5Form", "API Viewer")
arr = Getchild(i)
For x = LBound(arr) To UBound(arr)
t = arr(x)
wnd = win.GetWinProperties(t)
Me.Print wnd.ClassName & " > " & wnd.Caption
If wnd.ClassName = "ThunderRT5CommandButton" Then win.Caption(t) = "HAHAHA"
Next
End Sub
Private Sub GetWindows(Caption As String)
'This'll close all windows wich captions contain a certain string.
'Wildcards accepted!!!
'Usefull for pop-up-killers!
'just some info when the closewindow is triggered
'Lets say you specify:
' "*- Microsoft Internet Explorer" < close IE windows
' "*- Netscape" < close netscapes
' "*a* < close everything with an a in the caption
' "*Explorer" < close everything ending at Explorer
' "Microsoft*" < close everything beginning with Microsoft
'I think you get the point now :)
Dim win As New WindowHandler, arr As Variant, t&, x&, i&, wnd As wnd
arr = win.GetAllWindows(Me.hwnd)
For x = 0 To UBound(arr)
i = arr(x)
wnd = win.GetWinProperties(i)
If wnd.Caption Like Caption Then win.CloseWindow i
Next
End Sub
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
MsgBox "Dropped" 'This is just to notify the form that something gets dropped (for the DragDrop Example)
End Sub
Private Sub Form_Unload(Cancel As Integer)
'This is for unloading all forms to prevent crashing while looping in a few examples.
Dim Form As Form
Cncel = True 'This is a variable to stop the loopin'
For Each Form In Forms
Unload Form
Set Form = Nothing
Next
End
End Sub
You don't need all of it, but just posted all examples.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
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
|