Bubblez
The following function gives you complete control over the mouse cursor - place it in a new code module:
Code:
Declare Function LoadCursorBynum Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long
'Mouse Pointer Constants
Public Const IDC_APPSTARTING = 32650&
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&
Public Const IDC_CROSS = 32515&
Public Const IDC_IBEAM = 32513&
Public Const IDC_ICON = 32641&
Public Const IDC_NO = 32648&
Public Const IDC_SIZE = 32640&
Public Const IDC_SIZEALL = 32646&
Public Const IDC_SIZENESW = 32643&
Public Const IDC_SIZENS = 32645&
Public Const IDC_SIZENWSE = 32642&
Public Const IDC_SIZEWE = 32644&
Public Const IDC_UPARROW = 32516&
Public Const IDC_WAIT = 32514&
'*********** Code Start ************
'Code Courtesy of
'Terry Kreft
'
Function MouseCursor(CursorType As Long)
On Error GoTo HandleErr
Dim lngRet As Long
lngRet = LoadCursorBynum(0&, CursorType)
lngRet = SetCursor(lngRet)
ExitHere:
Exit Function
' Error handling block added by Error Handler Add-In. DO NOT EDIT this block of code.
' Automatic error handler last updated at 01-11-2002 14:15:25 'ErrorHandler:$$D=01-11-2002 'ErrorHandler:$$T=14:15:25
HandleErr:
Select Case Err.Number
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical, "Form_frmTasking.cmbJobNumber_AfterUpdate" 'ErrorHandler:$$N=Form_frmTasking.cmbJobNumber_AfterUpdate
'ErrorHandler:$$N=Form_frmTasking.cmbJobNumber_AfterUpdate
End Select
Resume ExitHere
' End Error handling block.
End Function
To make your cursor change shape, place the following code in the MouseMove event of your label:
Code:
MouseCursor IDC_HAND
To change the cursor back when it leaves the label, put this code in the forms Detail sections MouseMove event:
Code:
MouseCursor IDC_ARROW
You can also use
Code:
MouseCursor IDC_WAIT
whenever you wish to display the hourglass.
To make a checkbox equal to false when your form is opened, just set the Default Value property of each checkbox to False.
Brian Skelton
Braxis Computer Services Ltd.