Foot Wetter - Mouse Pointer

Foot Wetter - Mouse Pointer

Anonymous
Not applicable
808 Views
6 Replies
Message 1 of 7

Foot Wetter - Mouse Pointer

Anonymous
Not applicable
I am developing a full featured AutoCAD Add-in, currently using VBA.

For a start, I would like to change the Mouse Pointer, or Icon, to reflect
the status of the running VBA Macro. Does anyone have a quick tip where to
set the mouse pointer, or sample that would help me figure it out?

Thanks, Dave
0 Likes
809 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Sorry, let me clarify this.

I am trying to fill in the short comings of VBA with ObjectARX or AutoLISP
or whatever works. We will be converting entirely to ObjectARX in the
future.

So to start this process, I would like top figure out how to set a custom
Mouse Cursor or Pointer using ObjectARX.

Any pointers? 😉

Thanks, Dave
0 Likes
Message 3 of 7

Anonymous
Not applicable
Is this really such a difficult thing? Even in ARX??

Can anybody hear me? tap tap tap......
0 Likes
Message 4 of 7

Anonymous
Not applicable
You'd think there'd be one quick command to do this - but i couldn't find
that one command. I posted a similar question several times, and never got
an answer.

Here's what i've come up with. Create a point filter, or a point monitor
(AcEdInputPointFilter, AcEdInputPointMonitor) and make sure it's been added
to your current document. Next, make a call to disableSystemCursorGraphics
to turn off the AutoCAD pointer. Finally, make sure that your point filter
or monitor calls SetCursor every time it is executed (anytime the user moves
the mouse) to switch the cursor for your desired effect.

"DC Deno" wrote in message
news:[email protected]...
> Is this really such a difficult thing? Even in ARX??
>
> Can anybody hear me? tap tap tap......
>
>
0 Likes
Message 5 of 7

Anonymous
Not applicable
Excellent, thanks for that Justavian.

Looks like I'm gonna get a soaker right off the bat 🙂

I'll still appreciate any other comments.

Dave
0 Likes
Message 6 of 7

Anonymous
Not applicable
Don't get discouraged. The AcEdInputPointFilter looks like it's
ridiculously complicated, because of all of the arguments being passed to
it, but it's not as tough as it seems. Actually, if all you intend to do is
change the cursor, it should be quite easy. You can use the wizard bar (the
ObjectARX Input Point API button) to create a filter for you, and all you
should have to do is have some sort of global variable that determines if
your custom cursor should be shown (or some other manner of determining
that).

In the ProcessInputPoint( ) function, simply add the following lines (this
assumes that the variable 'ShowCustomCursor' is a global bool....


if(ShowCustomCursor)
{
// First, disable AutoCAD's default cursor.
// This only needs to be done once, so first check to see if
// it has already been disabled.
if(curDoc()->inputPointManager()->systemCursorDisableCount()==0)
curDoc()->inputPointManager()->disableSystemCursorGraphics();

// Now you're ready to show your cursor (assuming that
// myCursor is a valid HCURSOR that you previously loaded
// (something like myCursor =
acedGetAcadWinApp()->LoadCursor(IDC_HANDCUR); )
SetCursor(myCursor);

}
else
{
// We should NOT display the custom cursor - make sure the standard
// AutoCAD cursor is on....
if(curDoc()->inputPointManager()->systemCursorDisableCount()==1)
curDoc()->inputPointManager()->enableSystemCursorGraphics();
}


That's all there is to it! Again, i'm not sure if this is the best way to
do it, but i rely on this quite a bit since i change the cursor in all sorts
of different situations. I guess as long as it works, right?





"DC Deno" wrote in message
news:[email protected]...
> Excellent, thanks for that Justavian.
>
> Looks like I'm gonna get a soaker right off the bat 🙂
>
> I'll still appreciate any other comments.
>
> Dave
>
>
0 Likes
Message 7 of 7

yang8570
Enthusiast
Enthusiast

06/08/2012
Setting the Wait Cursor type using ObjectARX and Win32
by Fenton Webb
Sometimes, you want to tell the user that your application is busy and what better way to do that then with an Hour
Glass wait cursor… Obviously, you can create your own custom cursor and display it using the same technique…
Here’s how:
//////////////////////////////////////////////////////////////////////////
static HHOOK MyHook;
static HCURSOR hWaitCursor;
//////////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK MyMsgProc (int nCode, WPARAM wParam, LPARAM lParam);
//////////////////////////////////////////////////////////////////////////
// This is command 'WAITCURSOR, by Fenton Webb [14/10/2004], DevTech, Autodesk
void asdkWaitCursor()
{
// load the Wait cursor
hWaitCursor = LoadCursor(NULL, IDC_WAIT);
// and set it
HCURSOR hCursor = SetCursor(hWaitCursor);

// now set a hook so we can constantly keep our cursor set
MyHook = SetWindowsHookEx(WH_CALLWNDPROCRET, (HOOKPROC)MyMsgProc, (HINSTANCE)
NULL, GetCurrentThreadId ());
// now do the wait intensive task...
ACHAR cResult [256];
acedGetString (0, _T("\nPretending to wait : "), cResult);

// and finally clean up
UnhookWindowsHookEx (MyHook) ;

SetCursor (hCursor) ;
}
//////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK MyMsgProc (int nCode, WPARAM wParam, LPARAM lParam)
{
// forward the other hook calls
if ( nCode < 0 )
return (CallNextHookEx(MyHook, nCode, wParam, lParam));

LRESULT ret = CallNextHookEx(MyHook, nCode, wParam, lParam);

// keep updating our cursor type
SetCursor (hWaitCursor);

return (ret) ;
}
Posted at 04:13 PM in 2010, 2011, 2012, 2013, AutoCAD, Fenton Webb, ObjectARX | Permalink | Comments (4)

0 Likes