Dave's Brain

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

Date: 2010apr8
Platform: 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));
	}

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.