hi,
How to fix bug mention in this article:
http://support.microsoft.com/default...EN-US;Q113686&
?????
Pleas help me!!!
Regards
Printable View
hi,
How to fix bug mention in this article:
http://support.microsoft.com/default...EN-US;Q113686&
?????
Pleas help me!!!
Regards
Uhhh, upgrade to VB 4 or higher?Quote:
Microsoft
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.
I have Visual Basic 6, this bug isn't fixed.
Code:
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
With Picture1
.Left = .Left + 20
.Top = .Top + 20
End With
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
With Picture1
.Left = .Left - 20
.Top = .Top - 20
End With
End Sub
----
Then I press this picturebox much time and quick the button goes to up ant to left. So problem isn't fixed.
Maybe it's because you too-rapitly click the button... Maybe a doevents could do the trink...
VB Code:
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) With Picture1 .Left = .Left + 20 .Top = .Top + 20 End With DoEvents End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) With Picture1 .Left = .Left - 20 .Top = .Top - 20 End With DoEvents End Sub
No, i doesn't help.
Start new project and insert picturebox.
And this code:
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i
i = i + 1
Debug.Print "MouseDown - "; i
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static j
j = j + 1
Debug.Print "MouseUp - "; j
End Sub
You'll se the bug.
Indeed...
Sorry, I have no idea how to fix this.. :(
Perhaps install SP5 ? ? ?Quote:
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.
You can s/c the commandbutton and catch all WM_LMOUSEDOWN messages...
"s/c" what do you mean?
Can you give me an example?
s/c = SubClass
No example to give. Sorry...
VB Code:
Private Sub Form_Load() procOld = SetWindowLong(Me.hwnd, -4, AddressOf WindowProc) End Sub Private Sub Form_Unload(Cancel As Integer) SetWindowLong Me.hwnd, -4, procOld End Sub
VB Code:
Public Declare Function SetWindowLong Lib "user32" _ Alias "SetWindowLongA" (ByVal hwnd As Long, _ ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public 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 Public procOld As Long Private Const WM_LBUTTONDOWN = &H201 Private Const WM_LBUTTONUP = &H202 Public Function WindowProc(ByVal hwnd As Long, _ ByVal iMsg As Longn, ByVal wParam As Long, _ ByVal lParam As Long) As Long Select Case iMsg Case WM_LBUTTONDOWN MsgBox "Msg: LeftMouseDown Received" Case WM_LBUTTONUP MsgBox "Msg: LeftMouseUp Received" End Select WindowProc = CallWindowProc(procOld, hwnd, iMsg, _ wParam, lParam) End Function