|
-
May 13th, 2005, 03:58 PM
#1
Thread Starter
Frenzied Member
How to pass a Click through a form?
I've made a form which 'appears' to be transparent, using screen capture and alpha blending.
I want to make it so that if a user clicks my form, the mouse, and may be key clicks, pass through my form to what ever is underneath.
I found some code on PSC that can do this, but I believe it will only work on Win2K and up.
http://www.planet-source-code.com/vb...60484&lngWId=1
I'd like this to work on Win98 and up.
Here's what I've tried so far.
I can add the API's if you need them
VB Code:
Private Sub Form_Load()
' frmClickTo.Show
FormTopMost Me
End Sub
'
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim iX As Integer
Dim iY As Integer
Dim Pos As PointAPI
Dim lHwnd As Long
GetCursorPos Pos
Me.Visible = False
DoEvents
lHwnd = WindowFromPoint(Pos.x, Pos.Y)
SetForegroundWindow lHwnd
SysSetFocus lHwnd
DoEvents
Select Case Button
Case vbLeftButton
' mouse_event MOUSEEVENTF_LEFTDOWN, Pos.X, Pos.Y, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
' mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Case vbRightButton
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
Case vbMiddleButton
mouse_event MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0
End Select
Me.Visible = True
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim Pos As PointAPI
GetCursorPos Pos
Me.Visible = False
DoEvents
lHwnd = WindowFromPoint(Pos.x, Pos.Y)
SetForegroundWindow lHwnd
SysSetFocus lHwnd
DoEvents
'Debug.Print x
'Debug.Print Pos.x
'Debug.Print
'Debug.Print Y
'Debug.Print Pos.Y
Me.Visible = False
DoEvents
Select Case Button
Case vbLeftButton
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Case vbRightButton
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
Case vbMiddleButton
mouse_event MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0
End Select
Me.Visible = True
End Sub
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
|