Is it possible to change the cursor style?
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Is it possible to change the cursor style?

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Dave F.
Guest





Posted: Wed Mar 16, 2005 3:00 pm    Post subject: Is it possible to change the cursor style? Reply with quote

Hi

I want to use the cursor that's displayed for the Matchprop command
(Paintbrush) in my own routine.

Is this available to vba?

Thanks

Dave F..

Back to top
GTVic
Guest





Posted: Fri Mar 18, 2005 4:08 am    Post subject: Re: Is it possible to change the cursor style? Reply with quote

If you wanted to use that icon as a mouse pointer on your VBA form you would screen capture it and use appropriate software to save it as a workable format (like .cur or maybe .ico). Then set the MouseIcon property on your form or controls to that file and finally set the MousePointer value to 99 (custom icon).

If you wanted to show that pointer while picking objects on the AutoCAD screen then I would say you cannot do that from VBA. There are several sw products which modify the AutoCAD screen in some way but I believe most are written in C as an arx module.
Back to top
bcoward
Guest





Posted: Fri Mar 18, 2005 9:13 am    Post subject: Re: Is it possible to change the cursor style? Reply with quote

Dave,

In your own routine via VBA you could use the LoadCursorFromFile API. I used to use this to load the old Walking Dino curos from old NT4. Look into the API and you'll find other uses for it.

Test the following code..

Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpFileName As String) As Long
Private Declare Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long

Public Enum eCursorType
ecAppStarting = 32650 'The application starting (arrow and hourglass) cursor.
ecCross = 32515 'The cross-shaped cursor.
ecIBeam = 32513 'The text selection (I-beam) cursor.
ecIcon = 32641 'The empty icon cursor (Win NT only).
ecNo = 32648 'The circle with slash through it cursor.
ecNormal = 32512 'The normal arrow cursor.
ecSize = 32640 'The four-arrow resize/move cursor (Win NT only).
ecSizeAll = 32646 'The four-arrow resize/move cursor.
ecSizeNESW = 32643 'The double-arrow resize/move cursor pointing to the upper-right and lower-left.
ecSizeNS = 32645 'The double-arrow resize/move cursor pointing up and down.
ecSizeNWSE = 32642 'The double-arrow resize/move cursor pointing to the upper-left and lower-right.
ecSizeWE = 32644 'The double-arrow resize/move cursor pointing left and right.
ecUp = 32516 'The up arrow cursor.
ecWait = 32514 'The waiting (hourglass) cursor.
End Enum



'Purpose : Sets the curson for a specified from, from a file or resource.
'Inputs : lhwndForm The handle to the form.
' [sCursorPath] The path to a cursor.
' [lCursorHwnd] The handle to a cursor.
' [CursorType] A enumerated cursor type.

'Outputs : Returns the handle of the original cursor (to allow the cursor to be reset).

'Notes : Specify one of either the sCursorPath,lCursorHwnd or CursorType parameters.

Function FormCursorSet(lhwndForm As Long, Optional sCursorPath As String, Optional lCursorHwnd As Long, Optional lCursorType As eCursorType) As Long
Const GCL_HCURSOR As Long = (-12)

If Len(Dir$(sCursorPath)) > 0 And Len(sCursorPath) > 0 Then
'Load the cursor from file
lCursorHwnd = LoadCursorFromFile(sCursorPath)
FormCursorSet = SetClassLong(lhwndForm, GCL_HCURSOR, lCursorHwnd)
ElseIf lCursorHwnd Then
'Use the specified cursor handle
FormCursorSet = SetClassLong(lhwndForm, GCL_HCURSOR, lCursorHwnd)
ElseIf lCursorType Then
'Use the specified cursor types
lCursorHwnd = LoadCursor(ByVal 0&, CLng(lCursorType))
FormCursorSet = SetClassLong(lhwndForm, GCL_HCURSOR, lCursorHwnd)
End If
End Function

Good luck,

Bob Coward
CADS, Inc

800-366-0946
bcoward@mindspring.com

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB