|
-
Jan 6th, 2001, 12:35 PM
#1
Thread Starter
Frenzied Member
I'm trying to change the cursor to IDC_WAIT when a button is pressed in a dialog box. I looked at LoadCursor(), but it wants the instance handle to the application not the dialog box. I even tried it but it didn't load the icon.
Any help would be appreciated..
Dan
-
Jan 6th, 2001, 12:38 PM
#2
Monday Morning Lunatic
You don't need the instance handle for this:
Code:
SetCursor(LoadCursor(NULL, IDC_WAIT));
But remember to set it back again when you've finished...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 6th, 2001, 01:05 PM
#3
Thread Starter
Frenzied Member
Thanks, but it doesn't seem to work.. One thing concerns me.. I read the LoadCursor() reference and it says that it loads the cursor from the applications exe. Does that mean it would only load the IDC_ARROW because that's the only cursor I specified in the window's class? Do I need to create or do something else to make the IDC_WAIT cursor available to my application?
Any help would be appreciated..
Dan
-
Jan 6th, 2001, 01:16 PM
#4
Monday Morning Lunatic
Curious...
The documentation I have says:
To use one of the cursors predefined in the Microsoft® Win32® API, the application must set the hInstance parameter to NULL and the lpCursorName parameter to one the following values: Value Meaning
IDC_APPSTARTING Standard arrow and small hourglass
IDC_ARROW Standard arrow
IDC_CROSS Crosshair
IDC_HAND Windows 2000: Hand
IDC_HELP Arrow and question mark
IDC_IBEAM I-beam
IDC_ICON Obsolete for applications marked version 4.0 or later.
IDC_NO Slashed circle
IDC_SIZE Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.
IDC_SIZEALL Four-pointed arrow pointing north, south, east, and west
IDC_SIZENESW Double-pointed arrow pointing northeast and southwest
IDC_SIZENS Double-pointed arrow pointing north and south
IDC_SIZENWSE Double-pointed arrow pointing northwest and southeast
IDC_SIZEWE Double-pointed arrow pointing west and east
IDC_UPARROW Vertical arrow
IDC_WAIT Hourglass
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 6th, 2001, 01:39 PM
#5
Thread Starter
Frenzied Member
That's refering to the creation of the initial window class cursor.
But I did come across:
The Microsoft® Win32® API provides a set of standard cursors that are available for any application to use at any time. The SDK header files contain identifiers for the standard cursors — the identifiers begin with the "IDC_" prefix.
So apparently, I should have no problem using any cursor at any time.
I guess the only problem is figuring out the correct method of loading a different cursor. It seems to me that SetCursor(LoadCursor(NULL,IDC_WAIT)) should work but it doesn't..
Any other ideas?
-
Jan 6th, 2001, 01:43 PM
#6
Thread Starter
Frenzied Member
Okay, I think I found something.. In the SetCursor() reference, it says:
The cursor is a shared resource. A window should set the cursor shape only when the cursor is in its client area or when the window is capturing mouse input.
If your application must set the cursor while it is in a window, make sure the class cursor for the specified window's class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved.
Sure enough.. If I don't move the mouse after changing the cursor, it stays as an hourglass. But, as soon as I move the mouse, it changes back to the arrow..
Now I just have to figure out how to change the class cursor to NULL and then back again when I'm done with the hourglass...
-
Jan 6th, 2001, 01:55 PM
#7
Monday Morning Lunatic
Found it. Catch the WM_SETCURSOR message and return TRUE.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|