By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,023 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,023 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.