Click here to Skip to main content
15,916,042 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionClick throught a form Pin
Omar Mallat29-Oct-05 10:20
professionalOmar Mallat29-Oct-05 10:20 
AnswerRe: Click throught a form Pin
[Marc]29-Oct-05 10:51
[Marc]29-Oct-05 10:51 
GeneralRe: Click throught a form Pin
Omar Mallat29-Oct-05 10:55
professionalOmar Mallat29-Oct-05 10:55 
GeneralRe: Click throught a form Pin
[Marc]29-Oct-05 10:56
[Marc]29-Oct-05 10:56 
GeneralRe: Click throught a form Pin
Omar Mallat29-Oct-05 10:59
professionalOmar Mallat29-Oct-05 10:59 
GeneralRe: Click throught a form Pin
[Marc]29-Oct-05 11:03
[Marc]29-Oct-05 11:03 
GeneralRe: Click throught a form Pin
Omar Mallat29-Oct-05 11:09
professionalOmar Mallat29-Oct-05 11:09 
GeneralRe: Click throught a form Pin
[Marc]29-Oct-05 11:26
[Marc]29-Oct-05 11:26 
The WndProc sub has to do with the unmanaged Windows world. The Control class (from wich Label, Form etc are derived) is actually a kind of wrapper around the windows from Windows (now you know why it's called Windows Poke tongue | ;-P ). When something happens to such a window, WndProc gets the message. Then, according to the message, it calls the right Method.

For example, if you press the left mouse button on a Label, WndProc gets some messages. First the WM_NCHITTEST message (WM is for Window Message). that asks what kind of surface is below the mouse. HTTRANSPARENT means 'Just click right trough me'. HTCLIENT means something like 'Give me (= the control/window) more mouse messages', and then WndProc gets those, for example WM_LBUTTONDOWN. When Control.WndProc gets the WM_LBUTTONDOWN notification, it calls the OnMouseDown method, and that method raises the MouseDown event.
Public Class ClickThroughForm
    Inherits Form

Private Const WM_NCHITTEST As Integer = 132
Private Const HTTRANSPARENT As Integer = -1

Protected Overrides Sub WndProc(ByRef m as Message)
    If (m.Msg = WM_NCHITTEST) 'If Windows asks what kind of surface the mouse is on
        m.Result = New IntPtr(HTTRANSPARENT) 'Return that the mouse should go right through me
    Else
        MyBase.WndProc(m) 'Windows wants something else, let the base Control class do the work
    End If
End Sub

End Class

Maybe i'll write an article about this Smile | :)


Pompiedompiedom... Wink | ;)
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick

GeneralRe: Click throught a form Pin
Omar Mallat29-Oct-05 11:59
professionalOmar Mallat29-Oct-05 11:59 
GeneralRe: Click throught a form Pin
[Marc]29-Oct-05 13:09
[Marc]29-Oct-05 13:09 
GeneralRe: Click throught a form Pin
Greeky30-Oct-05 0:23
Greeky30-Oct-05 0:23 
QuestionUser Control does not process KeyDown event Pin
Gulfraz Khan29-Oct-05 2:03
Gulfraz Khan29-Oct-05 2:03 
AnswerRe: User Control does not process KeyDown event Pin
Christian Graus30-Oct-05 11:51
protectorChristian Graus30-Oct-05 11:51 
GeneralRe: User Control does not process KeyDown event Pin
Gulfraz Khan30-Oct-05 23:56
Gulfraz Khan30-Oct-05 23:56 
Questioncon not find keycodev2.dll or invalid keycode Pin
mostafa_h29-Oct-05 1:44
mostafa_h29-Oct-05 1:44 
Questionmschart control Pin
amadullah29-Oct-05 1:37
amadullah29-Oct-05 1:37 
AnswerRe: mschart control Pin
Joshua Quick29-Oct-05 11:18
Joshua Quick29-Oct-05 11:18 
Questionputing a icon in treeview Pin
Paritos28-Oct-05 21:00
Paritos28-Oct-05 21:00 
AnswerRe: puting a icon in treeview Pin
S. Senthil Kumar29-Oct-05 19:28
S. Senthil Kumar29-Oct-05 19:28 
QuestionHow do I print an invoice Pin
William Penington28-Oct-05 13:51
William Penington28-Oct-05 13:51 
AnswerRe: How do I print an invoice Pin
Gulfraz Khan29-Oct-05 3:07
Gulfraz Khan29-Oct-05 3:07 
QuestionRe: How do I print an invoice Pin
| Muhammad Waqas Butt |30-Oct-05 22:18
professional| Muhammad Waqas Butt |30-Oct-05 22:18 
AnswerRe: How do I print an invoice Pin
Gulfraz Khan31-Oct-05 0:11
Gulfraz Khan31-Oct-05 0:11 
QuestionVS 2005 Windows Service Install Pin
Brent Lamborn28-Oct-05 11:34
Brent Lamborn28-Oct-05 11:34 
Questionvb6 web browser control Pin
Lord Bogy28-Oct-05 7:33
Lord Bogy28-Oct-05 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.