i'm bulding a sub for block the mouse. testing every controls, but can't block in 1 control, if is choosed.
and heres the form code:Code:Option Explicit Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function ReleaseCapture Lib "user32" () As Long Public Sub BlockMouse(MainForm As Form, Optional ExceptControl As String) Dim ctlTemp As Control For Each ctlTemp In MainForm.Controls If ctlTemp.Name = ExceptControl Then ReleaseCapture Else SetCapture MainForm.hwnd End If Next ctlTemp End Sub
(these sub is for block the mouse in every controls, except if we choose 1 that can't be blocked... i'm doing these because, in same programs we don't need the mouse, but if we use we lose the focus)Code:Option Explicit Private Sub Command1_Click() MsgBox Command1.Name End Sub Private Sub Command2_Click() MsgBox Command2.Name End Sub Private Sub Form_Load() End Sub Private Sub Timer1_Timer() BlockMouse Form1, Command1.Name End Sub
it seems working, but isn't ignored in that control... can anyone advice-me?





Reply With Quote