奇葩说第三季80s:vcAPI编程中如何创建自定义光标?

来源:百度文库 编辑:高考问答 时间:2024/04/27 20:06:41
请高手顺便写出资源文件中的相关格式

如果你是指编辑用的插入符光标:
BOOL CreateCaret(
HWND hWnd, // handle to owner window
HBITMAP hBitmap, // handle to bitmap for caret shape
int nWidth, // caret width
int nHeight // caret height
);

SetCaretPos(x, y);
ShowCaret(hwnd);

如果你是指鼠标光标:
HCURSOR LoadCursor(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpCursorName // name or resource identifier
);
HCURSOR SetCursor(
HCURSOR hCursor // handle to cursor
);

例如:

HCURSOR t=LoadCursor(hInstance,
MAKEINTRESOURCE(IDC_MYCURSOR));
HCURSOR oldcursor=SetCursor(t);
IDC_MYCURSOR: 是资源文件中对应光标ID号
hInstance:你的进程句柄