长时间执行操作,显示等待图标.

长时间执行操作,显示等待图标.

如果程序中,需要进行长时间等待操作,可以显示等待图标,这样可以给人更好的体验.
在WIN32中,主要有SetCursor()函数来设置显示的图标.
在MSDN中对该函数的说明为:
HCURSOR SetCursor(
  HCURSOR 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.

而里面需要用到LoadCursor()函数,
HCURSOR LoadCursor(
  HINSTANCE 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.
 
因此要用显示系统的等待图标,可以为
SetCursor(LoadCursor(NULL, IDC_WAIT));
然后在结束的时候再把默认图标切换回来.
SetCursor(LoadCursor(NULL, IDC_ARROW));
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值