asked on
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
Private Declare Function DestroyCursor Lib "user32" (ByVal hCursor As Long) As Long
Private Const OCR_NORMAL = 32512
Private Const IDC_WAIT = 32514&
Sub CursorWait()
Dim hCursor As Long
On Error GoTo Error_Handler
hCursor = LoadCursor(ByVal 0&, IDC_WAIT)
SetSystemCursor hCursor, OCR_NORMAL
DestroyCursor hCursor
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: CursorWait" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Sub
Sub CursorNormal()
Dim hCursor As Long
On Error GoTo Error_Handler
hCursor = LoadCursor(ByVal 0&, OCR_NORMAL)
SetSystemCursor hCursor, IDC_WAIT
DestroyCursor hCursor
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: CursorNormal" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Sub
Public Declare PtrSafe Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As LongPtr, ByVal lpCursorName As String) As LongPtr
Private Declare PtrSafe Function SetSystemCursor Lib "user32" (ByVal HCur As LongPtr, ByVal id As Long) As Long
Private Declare PtrSafe Function DestroyCursor Lib "user32" (ByVal hCursor As LongPtr) As Long
Private Const OCR_NORMAL = 32512
Private Const IDC_WAIT = 32514&
Sub CursorWait()
Dim hCursor As LongPtr
On Error GoTo Error_Handler
hCursor = LoadCursor(ByVal 0&, IDC_WAIT)
SetSystemCursor hCursor, OCR_NORMAL
DestroyCursor hCursor
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: CursorWait" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Sub
Sub CursorNormal()
Dim hCursor As LongPtr
On Error GoTo Error_Handler
hCursor = LoadCursor(ByVal 0&, OCR_NORMAL)
SetSystemCursor hCursor, IDC_WAIT
DestroyCursor hCursor
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: CursorNormal" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Sub
No, that is the call (unless the docs are wrong). Looked at the same thing myself. Doesn't seem right, but that's what the docs state.
Jim.
ASKER
I should have caught that one 32-bit Long, 64-bit String?! Thank you all for your assistance.
<< I should have caught that one 32-bit Long, 64-bit String?! Thank you all for your assistance.>>
I caught this when I first looked at it, but the Office 2010 API docs do have it as a string and the on-line docs have it as an lpstr.
Thought it was weird but I didn't have 64 bit here to check it out with.
Jim.
ASKER
Yes, that the doc. I used. I've since reported the issue. Hopefully MS will update the doc to save others this frustration.
Microsoft Outlook is a personal information manager from Microsoft, available as a part of the Microsoft Office suite. Although often used mainly as an email application, it also includes a calendar, task manager, contact manager, note-taker, journal, and web browser.
TRUSTED BY