我需要以某种方式将光标设置为C ++应用程序的“Select Precision”指针(水平和垂直交叉)。
有谁知道如何使用WinApi协议进行集成?
答案 0 :(得分:1)
初始化代码中的某处:
HCURSOR precision_cursor = LoadCursor( NULL, IDC_CROSS );
和窗口程序:
LRESULT CALLBACK YourWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
switch ( msg )
{
case WM_SETCURSOR:
// If you omit test below, you will change cursor also for scrollbars, frames, etc.
if ( LOWORD( lparam ) == HTCLIENT )
{
SetCursor( precision_cursor );
return TRUE;
}
break;
}
// This will also handle cursor for scrollbars and frames.
return DefWindowProc( hwnd, msg, wparam, lparam );
}