home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Find Window"
- ClientHeight = 1365
- ClientLeft = 1125
- ClientTop = 2250
- ClientWidth = 4335
- Height = 1770
- Icon = FINDWND.FRX:0000
- Left = 1065
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 1365
- ScaleWidth = 4335
- Top = 1905
- Width = 4455
- Begin TextBox Text2
- Height = 315
- Left = 1320
- TabIndex = 1
- Text = "Microsoft Excel"
- Top = 960
- Width = 2055
- End
- Begin CommandButton btnQuit
- Caption = "&Quit"
- Height = 615
- Left = 3540
- TabIndex = 3
- Top = 660
- Width = 735
- End
- Begin TextBox Text1
- Height = 315
- Left = 1320
- TabIndex = 0
- Text = "XLMAIN"
- Top = 660
- Width = 2055
- End
- Begin CommandButton btnFind
- Caption = "&Find"
- Height = 615
- Left = 3540
- TabIndex = 2
- Top = 60
- Width = 735
- End
- Begin PictureBox Picture1
- BorderStyle = 0 'None
- Height = 615
- Left = 1500
- ScaleHeight = 615
- ScaleWidth = 1815
- TabIndex = 4
- TabStop = 0 'False
- Top = 0
- Width = 1815
- End
- '**********************************************************'
- '* *'
- '* Find Window *'
- '* *'
- '* Find Window allows you to type a Caption and/or *'
- '* ClassName into the textboxes on the form and see *'
- '* if a Window exists that matches those criteria. I *'
- '* use it to check on the format of captions used in *'
- '* applications to make sure I haven't mistaken a set *'
- '* of parenthesis for a set of square brackets, etc... *'
- '* It's also useful when you use SPY to find Class *'
- '* Names and you want to make sure it's not lying to *'
- '* you<g>. Do with it as you will. *'
- '* *'
- '* Let me know if you find it useful, or not. *'
- '* *'
- '* Gregg Irwin CIS:ID 72450,676 *'
- '* *'
- '**********************************************************'
- DefInt A-Z
- Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any, ByVal lpCaption As Any)
- Const KEY_ENTER = 13
- Const NULL = 0&
- Sub btnFind_Click ()
- lpClassName$ = Text1.Text
- lpCaption$ = Text2.Text
- Picture1.Cls
- Picture1.Print " Handle = "; FindWindow(lpClassName$, NULL)
- Picture1.Print " Handle = "; FindWindow(NULL, lpCaption$)
- Picture1.Print " Handle = "; FindWindow(lpClassName$, lpCaption$)
- End Sub
- Sub btnQuit_Click ()
- End
- End Sub
- Sub Form_Paint ()
- CurrentX = 120: CurrentY = 720
- Print "ClassName :"
- CurrentX = 420: CurrentY = 1020
- Print "Caption :"
- CurrentX = 0: CurrentY = 0
- Print " ClassName Only"
- Print " Caption Only"
- Print " Class & Caption"
- End Sub
- Sub Form_Unload (Cancel As Integer)
- End
- End Sub
- Sub Text1_KeyPress (KeyAscii As Integer)
- If KeyAscii = KEY_ENTER Then 'If Enter is hit
- KeyAscii = 0 'Supress beep
- SendKeys "{TAB}" 'Go to next field
- End If
- End Sub
- Sub Text2_KeyPress (KeyAscii As Integer)
- If KeyAscii = KEY_ENTER Then
- KeyAscii = 0
- SendKeys "{TAB}"
- End If
- End Sub
-