SetCursor(LoadCursor(NULL,IDC_WAIT))应该是IDC_WAIT这个吧IDC_APPSTARTING Standard arrow and small hourglass IDC_ARROW Standard arrow IDC_CROSS Crosshair IDC_HAND Windows 98/Me, Windows 2000/XP: Hand IDC_HELP Arrow and question IDC_IBEAM I-beam IDC_ICON Obsolete for applications ed version 4.0 or later. IDC_NO Slashed circle IDC_SIZE Obsolete for applications ed 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
Displaying a Cursor The system automatically displays the class cursor (the cursor associated with the window to which the cursor is pointing). You can assign a class cursor while registering a window class. The following example illustrates this by assigning a cursor handle to the hCursor member of the WNDCLASS structure identified by the wc parameter. WNDCLASS wc;
// Fill the window class structure with parameters that // describe the main window.
wc.style = NULL; // class style(s) wc.lpfnWndProc = (WNDPROC) MainWndProc; // window procedure wc.cbClsExtra = 0; // no per-class extra data wc.cbWndExtra = 0; // no per-window extra data wc.hInstance = hinst; // application that owns the class wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); // class icon wc.hCursor = LoadCursor(hinst, MAKEINTRESOURCE(230)); // class cursor wc.hbrBackground = GetStockObject(WHITE_BRUSH); // class background wc.lpszMenuName = "GenericMenu"; // class menu wc.lpszClassName = "GenericWClass" // class name
// Register the window class.
return RegisterClass(&wc); When the window class is registered, the cursor identified by 230 in the application's resource-definition file is the default cursor for all windows based on the class. Your application can change the design of the cursor by using the SetCursor function and specifying a different cursor handle. However, when the cursor moves, the system redraws the class cursor at the new location. To prevent the class cursor from being redrawn, you must process the WM_SETCURSOR message. Each time the cursor moves and mouse input is not captured, the system sends this message to the window in which the cursor is moving. You can specify different cursors for different conditions while processing WM_SETCURSOR. For example, the following example shows how to display the hCurs3 cursor whenever the cursor moves over the icon of a minimized application. case WM_SETCURSOR:
// If the window is minimized, draw the hCurs3 cursor. // If the window is not minimized, draw the default // cursor (class cursor).
if (IsIconic(hwnd)) { SetCursor(hCurs3); break; } When the window is not minimized, the system displays the class cursor. You can replace a class cursor by using the SetClassLong function. This function changes the default window settings for all windows of a specified class. The following example replaces the existing class cursor with the hCurs2 cursor. // Change the cursor for window class represented by hwnd.
IDC_ARROW Standard arrow
IDC_CROSS Crosshair
IDC_HAND Windows 98/Me, Windows 2000/XP: Hand
IDC_HELP Arrow and question
IDC_IBEAM I-beam
IDC_ICON Obsolete for applications ed version 4.0 or later.
IDC_NO Slashed circle
IDC_SIZE Obsolete for applications ed 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
The system automatically displays the class cursor (the cursor associated with the window to which the cursor is pointing). You can assign a class cursor while registering a window class. The following example illustrates this by assigning a cursor handle to the hCursor member of the WNDCLASS structure identified by the wc parameter. WNDCLASS wc;
// Fill the window class structure with parameters that
// describe the main window.
wc.style = NULL; // class style(s)
wc.lpfnWndProc = (WNDPROC) MainWndProc; // window procedure
wc.cbClsExtra = 0; // no per-class extra data
wc.cbWndExtra = 0; // no per-window extra data
wc.hInstance = hinst; // application that owns the class
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); // class icon
wc.hCursor = LoadCursor(hinst, MAKEINTRESOURCE(230)); // class cursor
wc.hbrBackground = GetStockObject(WHITE_BRUSH); // class background
wc.lpszMenuName = "GenericMenu"; // class menu
wc.lpszClassName = "GenericWClass" // class name
// Register the window class.
return RegisterClass(&wc);
When the window class is registered, the cursor identified by 230 in the application's resource-definition file is the default cursor for all windows based on the class. Your application can change the design of the cursor by using the SetCursor function and specifying a different cursor handle. However, when the cursor moves, the system redraws the class cursor at the new location. To prevent the class cursor from being redrawn, you must process the WM_SETCURSOR message. Each time the cursor moves and mouse input is not captured, the system sends this message to the window in which the cursor is moving. You can specify different cursors for different conditions while processing WM_SETCURSOR. For example, the following example shows how to display the hCurs3 cursor whenever the cursor moves over the icon of a minimized application. case WM_SETCURSOR:
// If the window is minimized, draw the hCurs3 cursor.
// If the window is not minimized, draw the default
// cursor (class cursor).
if (IsIconic(hwnd))
{
SetCursor(hCurs3);
break;
}
When the window is not minimized, the system displays the class cursor. You can replace a class cursor by using the SetClassLong function. This function changes the default window settings for all windows of a specified class. The following example replaces the existing class cursor with the hCurs2 cursor. // Change the cursor for window class represented by hwnd.
SetClassLong(hwnd, // window handle
GCL_HCURSOR, // change cursor
(LONG) hCurs2); // new cursor
msdn上的例子,你去看看吧
试试