📄 frmmouseselect.frm
字号:
VERSION 5.00
Begin VB.Form frmMouseSelect
Caption = "Select Window"
ClientHeight = 2640
ClientLeft = 60
ClientTop = 345
ClientWidth = 6810
ClipControls = 0 'False
Icon = "frmMouseSelect.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 6810
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 435
Left = 3600
TabIndex = 16
Top = 2160
Width = 1395
End
Begin VB.CommandButton cmdOk
Caption = "Ok"
Default = -1 'True
Height = 435
Left = 2100
TabIndex = 15
Top = 2160
Width = 1395
End
Begin VB.TextBox txthWnd
Height = 285
Left = 2040
TabIndex = 14
Top = 60
Width = 2355
End
Begin VB.Timer TimerSelect
Enabled = 0 'False
Interval = 50
Left = 4200
Top = 1680
End
Begin VB.Label lblProgClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 195
Index = 1
Left = 2940
TabIndex = 13
Top = 1560
Width = 45
End
Begin VB.Label lblParClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 195
Index = 1
Left = 2940
TabIndex = 12
Top = 960
Width = 45
End
Begin VB.Label lblClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 195
Index = 1
Left = 2940
TabIndex = 11
Top = 360
Width = 45
End
Begin VB.Label lblProcess
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 195
Index = 1
Left = 2940
TabIndex = 10
Top = 1860
Width = 45
End
Begin VB.Label lblProghWnd
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 195
Index = 1
Left = 2940
TabIndex = 9
Top = 1260
Width = 45
End
Begin VB.Label lblParhWnd
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 195
Index = 1
Left = 2940
TabIndex = 8
Top = 660
Width = 45
End
Begin VB.Label lblProgClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Progenitor Class:"
Height = 195
Index = 0
Left = 1500
TabIndex = 7
Top = 1560
Width = 1185
End
Begin VB.Label lblParClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Parent Class:"
Height = 195
Index = 0
Left = 1500
TabIndex = 6
Top = 960
Width = 930
End
Begin VB.Label lblClass
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Class:"
Height = 195
Index = 0
Left = 1500
TabIndex = 5
Top = 360
Width = 420
End
Begin VB.Label lblProcess
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Process Name:"
Height = 195
Index = 0
Left = 1500
TabIndex = 4
Top = 1860
Width = 1080
End
Begin VB.Label lblProghWnd
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Progenitor hWnd:"
Height = 195
Index = 0
Left = 1500
TabIndex = 3
Top = 1260
Width = 1245
End
Begin VB.Label lblParhWnd
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Parent hWnd:"
Height = 195
Index = 0
Left = 1500
TabIndex = 2
Top = 660
Width = 990
End
Begin VB.Label lblHwnd
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "hWnd:"
Height = 195
Index = 0
Left = 1500
TabIndex = 1
Top = 60
Width = 480
End
Begin VB.Label lblSelect
BackStyle = 0 'Transparent
Caption = "Select Window:"
Height = 195
Left = 120
TabIndex = 0
Top = 420
Width = 1125
End
Begin VB.Image imgBackUp
Height = 480
Left = 360
Picture = "frmMouseSelect.frx":030A
Top = 1320
Visible = 0 'False
Width = 480
End
Begin VB.Image imgSelect
BorderStyle = 1 'Fixed Single
Height = 510
Left = 360
Top = 720
Width = 510
End
End
Attribute VB_Name = "frmMouseSelect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'
' I have been to great troubles to learn all of the techniques in this program.
' I have spent many, many hours and late nights coding the many functions which I
' have included. As much as I resent it, Planet Source Code requires that I put
' the source code in the zip file. So I have placed it in here for you to view.
' Please use it wisely. And give me credit for all of the hard work that I have
' done. My biggest fear is that somebody will do an almost straight rip of this
' code, and take the credit for themselves. Please do not let this happening. I'm
' placing a lot of trust there. So please, use this program, use this code, and
' give me credit for it. If anybody rips all my routines, then my secret spy's
' (and I have a lot of them, as soon as I hire them) will tell me, and I'll get
' into my private jet (as soon as I buy it) and track you down over the whole
' world and eventually KILL YOU. You get the idea? Thanks. Read on for something
' a little more interesting!
'
' Code is Copyright Jolyon Bloomfield, February 2000
'
'
' Note: The graphics code for this form I released on Planet-Source-Code on 2/3/2000
' You may download it there. Jolyon Bloomfield.
'
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long ' Get the cursor position
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long ' Get the handle of the window that is foremost on a particular X, Y position. Used here to get the window under the cursor
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long ' Get the window co-ordinates in a RECT structure
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long ' Retrieve a handle for the hDC of a window
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long ' Release the memory occupied by an hDC
Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long ' Create a GDI graphics pen object
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long ' Used to select brushes, pens, and clipping regions
Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long ' Get hold of a "stock" object. I use it to get a Null Brush
Private Declare Function SetROP2 Lib "gdi32" (ByVal hdc As Long, ByVal nDrawMode As Long) As Long ' Used to set the Raster OPeration of a window
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long ' Delete a GDI Object
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long ' GDI Graphics- draw a rectangle using current pen, brush, etc.
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long ' Set mouse events only for one window
Private Declare Function ReleaseCapture Lib "user32" () As Long ' Release the mouse capture
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long ' Create a rectangular region
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long ' Select the clipping region of an hDC
Private Declare Function GetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long ' Get the Clipping region of an hDC
Private Const NULL_BRUSH = 5 ' Stock Object
Private Selecting As Boolean ' Am I currently selecting a window?
Private BorderDrawn As Boolean ' Is there a border currently drawn that needs to be undrawn?
Private Myhwnd As Long ' The current hWnd that has a border drawn on it
Public Selected As Boolean ' I have selected a window
Private Sub cmdCancel_Click()
Screen.MousePointer = MousePointerConstants.vbDefault
Screen.MouseIcon = LoadPicture()
imgSelect.Picture = imgBackUp.Picture
ReleaseCapture
Selecting = False
TimerSelect.Enabled = False
Me.txthWnd.Text = 0
Selected = True
Unload Me
End Sub
Private Sub cmdOk_Click()
Screen.MousePointer = MousePointerConstants.vbDefault
Screen.MouseIcon = LoadPicture()
imgSelect.Picture = imgBackUp.Picture
ReleaseCapture
Selecting = False
TimerSelect.Enabled = False
Dim Enumit As New Enumerator
If Enumit.IsValidWindow(Val("&H" & Me.txthWnd.Text)) = False Then
MsgBox "Please enter a valid window handle in HEXEDECIMAL.", vbInformation, "Invalid Handle"
Exit Sub
End If
UpdateInfo Val("&H" & Me.txthWnd.Text)
Selected = True
Unload Me
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbFormCode Then Else Selected = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Me.Visible = False Then Exit Sub
Me.Visible = False
If Selected = True Then
Cancel = True
Selected = False
frmSelect.Visible = True
frmSelect.ReturnhWnd = CLng(Val("&H" & Me.txthWnd.Text))
Else
Cancel = True
Selected = False
Selecting = False
frmSelect.ReturnhWnd = 0
frmSelect.Visible = True
End If
End Sub
Private Sub imgSelect_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Screen.MousePointer = MousePointerConstants.vbCustom
Screen.MouseIcon = imgSelect.Picture
imgSelect.Picture = LoadPicture()
Selecting = True
SetCapture Me.hwnd
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -