Microsoft KB Archive/149699

= FIX: RichTextBox Control Prevents Click Event from Firing =

Article ID: 149699

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q149699



SYMPTOMS
After double-clicking on the RichTextBox, the Click event for other controls does not fire the next time the left mouse button is pressed.



RESOLUTION
  Place the following code in the Declarations portion of the form: Private Declare Function SendMessage Lib "user32" Alias _ "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _        ByVal wParam As Long, lParam As Long) As Long

Const MOUSEEVENTF_LEFTUP = &H4 Const WM_LBUTTONUP = &H202   Place the following code in the DblClick event for the RichTextBox: Private Sub RichTextBox1_DblClick Dim retval As Long retval = SendMessage(RichTextBox1.hwnd, WM_LBUTTONUP, 0, 0) End Sub 



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Basic 6.0.



Steps to Reproduce Behavior
 Start a new project in Visual Basic. Form1 is created by default. Add a RichTextBox and a CommandButton to the form. Their names become RichTextBox1 and Command1 by default.  Add the following code to the CommandButton's Click event: Private Sub Command1_Click MsgBox "Click Event!" End Sub  Run the project. Double-click on the RichTextBox and click once on the CommandButton. The Click event will not fire on the first click. After the first click, everything functions normally.</li></ol>

Additional query words: kbVBp400bug kbVBp600fix kbVBp kbdsd kbDSupport kbCtrl

Keywords: kbbug kbfix kbvbp600fix KB149699

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.