Browse - Programming Tips - How can I change the cursor for a specific window?

Date: 2010apr8
OS: Windows

Q.  How can I change the cursor for a specific window?

A.  Use SetClassLong, like this:

void SetWindowCursor(HWND hwnd, const HCURSOR hCursor) { SetClassLong(hwnd, GCL_HCURSOR, PtrToLong(hCursor)); } void exampleUse(HWND hwnd) { SetWindowCursor(hwnd, LoadCursor(NULL, IDC_HAND)); }