Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Changing the Mouse

marshallc
Beginner
518 Views
Is there a way to change the mouse cursor to another image? If so, could someone please provide sample code on how to do this? I'm new to Fortran and appreciate any help you can give a newbie.
Thanks!

Message Edited by marshallc on 10-26-2004 08:57 AM

0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
518 Views
That really depends on the type of application you build. I assume it's a Standard graphic/QuickWin one?
In any case, you should:
1) Insert/Resource/Cursor
2) Draw your cursor in the resource editor and assign it an ID
To assign cursor to entire window, you could use SetWindowLong API:
Code:
use DFWIN
integer, save:: hOldCursor, hCursor

hCursor = LoadCursor(GetModuleHandle(0), IDC_YOURCURSOR)
hOldCursor = SetClassLong(GetHwndQQ(YourUnit), GCL_HCURSOR, hCursor)
ret = SetCursor(GetHwndQQ(YourUnit), hCursor)
...

SetClassLong returns the handle of the old cursor, thushOldCursor will normally be a handle of arrow cursor.

You should pay attention to save the handle to hCursor and restore hOldCursor once you're done; the hCursor must be destroyed when you don't need it anymore using DestroyCursor(hCursor) API.

If you want your cursor to change in different areas of the same window, that's more difficult.

Jugoslav

0 Kudos
Reply