如何在C++应用程序中设置"Select Precision"光标?

How do I set the "Select Precision" cursor in a C++ application?

本文关键字:Select Precision 光标 设置 C++ 应用程序      更新时间:2023-10-16

我需要以某种方式将光标设置为C++应用程序的"选择精度"指针(水平和垂直交叉(。

有谁知道如何使用 WinApi 协议集成它?

初始化代码中的某个地方:

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 );
}