Archived

This topic is now archived and is closed to further replies.

Using a Custom cursor

This topic is 4985 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey, I use VC++.net and I made a custom cursor for a game im making but am unable to figure out how to make it the cursor. I''ve tried setting the call of wc.hCursor= LoadCursor(NULL, IDC_WHATEVER); so the IDC_*** matches the cursor''s name but it says that that variable doesnt exist. Any1 know a way to import custom cursors from resources? -Mark

Share this post


Link to post
Share on other sites
try
LoadCursor(hInstance, IDC_YOURCURSOR); 

replacing hInstance by your application's instance

you can also try
LoadCursor(hInstance, MAKEINTRESOURCE(IDC_YOURCURSOR)); 


hope that helps !
Matt

PS: this is untested and I never loaded a custom cursor myself

[edited by - lemurion on April 20, 2004 2:53:09 PM]

Share this post


Link to post
Share on other sites
Couple of points to check I think:

If it says IDC_WHATEVER is undefined, have you included the resource header file which VC++ defines custom resource IDs in.
It''s usually has the same name as you .rc file but with the .h header file extension instead.

lemurion is right, you will need to specify a handle to the exe containing the resource. This could either be the first HISTANCE param passed to WinMain( ... ) or you can use GetModuleHandle( NULL ) to return the currently executing module''s handle.

Finally, the resource id parameter in LoadCursor is a string. However VC++ uses integers. Integers are valid but they must be passed in the correct way. You can use the macro MAKEINTRESOURCE( IDC_WHATEVER ) to convert your id to a suitable string value.

Hope that helps.
James

Share this post


Link to post
Share on other sites