is this a known bug or am i missing something...

Ranma_at
01-21-2004, 03:34 AM
Hello,

Create a new project, place a picturebox on it, copy it and paste it so you have an array of picturebox1().


Then place following code in your form,


Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1



Private Sub Picture1_Click(Index As Integer)
MsgBox "Hello World", vbInformation
End Sub

Private Sub Picture1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
ReleaseCapture
SendMessage Picture1(Index).hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub


Private Sub Picture1_Click(Index As Integer) DOESNT REACT WITH THE LEFT MOUSE BUTTON, only the right one !!!, until you remove the Picture1_MOUSEDOWN event.

thats weird

Am i missing something or is it a bug ??

regards

Ranma_at

NimX
01-21-2004, 03:43 AM
Mouse down event alway occur before click even...
so i think what you did in mouse down event is sending message to window and the same is clearing(Wave) click event ..
Can you elobrate what you are trying to do in SendMessage fucntion..

passel
01-21-2004, 09:26 AM
In the MouseDown, if the button is 1, you do a releaseCapture which
releases the mouse so you will never get a click event for that button.
The code you have is to allow dragging the window (sending the mouse
click to the Caption of the control).

Did you try dragging the mouse to see that your picturebox moves?

You can't have the left button used to move the picturebox, and process
a click at the same time. You need to choose which you want. You
could put logic in the mouse down that checks if "move" is enabled, then
do the send message, otherwise let the normal processing continue, in
which case you won't release the mouse, and normal click processing will
happen.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum