Dave's Brain

Browse - programming tips - set 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));
	}
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, 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.
Advertisements: