471,893 Members | 1,361 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,893 software developers and data experts.

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 1593

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 zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.