DblClick event for MaskEdBox

We need to detect when the user double-clicks on a Masked Edit box in VB 5.0.  Unfortunately, the MaskEdBox control does not have the DblClick event, nor the Click event (and we're puzzled as to why not).  Seeking help.  Thanks in advance.
pbrooksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bin_huwairibCommented:
pbrooks,

You can build your own windows message handler for Masked Edit control with AddressOf operator.

Example
=======
1- Add form1 to project1.
2- Add module1 to project1.
3- Add maskedit control to form1.

=== paste this code in form1 ===
Private Sub Form_Click()
 UnHook
End Sub

Private Sub Form_Load()
 gHW = MaskEdBox1.hWnd
 Hook
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
 UnHook
End Sub


=== paste this code in module1 ===
    Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
           (ByVal lpPrevWndFunc As Long, _
            ByVal hWnd As Long, _
            ByVal Msg As Long, _
            ByVal wParam As Long, _
            ByVal lParam As Long) As Long
 
    Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
           (ByVal hWnd As Long, _
            ByVal nIndex As Long, _
            ByVal dwNewLong As Long) As Long
 
    Public Const GWL_WNDPROC = -4
 
    Public Const WM_LBUTTONDBLCLK = &H203

    Global lpPrevWndProc As Long
    Global gHW As Long
 
    Public Sub Hook()
        lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, _
                                     AddressOf WindowProc)
    End Sub
 
    Public Sub UnHook()
        Dim lngReturnValue As Long
        lngReturnValue = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
    End Sub
 
    Function WindowProc(ByVal hw As Long, _
                        ByVal uMsg As Long, _
                        ByVal wParam As Long, _
                        ByVal lParam As Long) As Long
     
        Select Case uMsg
            Case WM_LBUTTONDBLCLK
                Form1.Caption = "Double Click.."
               
            Case Else
                WindowProc = CallWindowProc(lpPrevWndProc, hw, _
                                           uMsg, wParam, lParam)
        End Select
    End Function


Best regards
Bin Huwairib
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pbrooksAuthor Commented:
Excellent!  This is exactly the answer I was looking for.  My hat's off to the expert  for a fast and accurate solution.

0
rogerkjCommented:
I have the same problem as pbrooks except that my masked edit box is on a UserControl instead of a Form.
I tried your answer but in the Select case I did not have access to the usercontrol (I wanted to call a sub on the usercontrol).

   Select Case uMsg
      Case WM_LBUTTONDBLCLK
          no access to UC
      Case Else

Any ideas?

If you do I can post a question so you can get points for your answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.