469,140 Members | 1,169 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,140 developers. It's quick & easy.

Make a form "click through" or transparent to mouse events

I have been nagging for help on this subject for quite some time now.
Finally got it sorted out by my self.
Here is the code if some one else ever need it.


Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" _
(ByVal hwnd As System.IntPtr, ByVal nIndex As Integer) As

Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hwnd As System.IntPtr, ByVal nIndex As Integer, _
ByVal dwNewLong As Integer) As Integer
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_TRANSPARENT = &H20&

'In your sub:

Private Sub Form1_load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

Call SetWindowLong(Me.Handle, GWL_EXSTYLE, _
GetWindowLong(Me.Handle, GWL_EXSTYLE) _
End sub

I find it quite useful to show help or info in a semi transparent form
TopMost = True, that ignores the mouse and keyboard actions so you can
go on working in the underlying windows but still be able to read the
You have to controle the thread from your main form, so you can make a
button to close it with.

/Per Larsson
Nov 21 '05 #1
0 1487

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by DS | last post: by
4 posts views Thread by Omar Llanos | last post: by
2 posts views Thread by Sakharam Phapale | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.