The wait icon is displayed when the operation is executed for a long time.
If you need to wait for a long time in the program, you can display the wait icon to give you a better experience.
In Win32, The setcursor () function is used to set the displayed icon.
The description of this function in msdn is:
Hcursor setcursor (
Hcursor
);
Hcursor
[In] handle to the cursor. The cursor must have been created by the createcursor or loaded by the loadcursor or LoadImage function. If this parameter is null, the cursor is removed from the screen.
The width and height of the cursor must be the values returned by the getsystemmetrics function for sm_cxcursor and sm_cycursor.
The loadcursor () function is required,
Hcursor loadcursor (
Hinstance,
Lpctstr lpcursorname
);
To use one of the Microsoft Win32 predefined cursors, the application must set the hinstance parameter to null and the lpcursorname parameter to a specific value. the following table shows the possible values. this parameter must be set to one of these values.
Value description
Idc_appstarting
Standard arrow and small Hourglass.
Idc_arrow
Standard arrow.
Idc_cross
Crosshair.
Idc_hand
Hand.
Idc_help
Arrow and question mark.
Idc_icon
Obsolete.
Idc_no
Slashed circle.
Idc_size
Obsolete; 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.
Therefore, use the wait icon to display the system, which can be
Setcursor (loadcursor (null, idc_wait ));
Then, switch the default icon back at the end.
Setcursor (loadcursor (null, idc_arrow ));