長時間執行操作,顯示等待表徵圖.

來源:互聯網
上載者:User

長時間執行操作,顯示等待表徵圖.

如果程式中,需要進行長時間等待操作,可以顯示等待表徵圖,這樣可以給人更好的體驗.
在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));
 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.