Archived

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

MFC and SetCursor()

This topic is 5574 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

I have a problem with SetCursor in my mfc dialog based app. When i try to set the cursor to a different one (in this case to the east/west or north/south double pointed arrow), it flickers between the cursor I want and the regular arrow cursor. So i fired up msdn to look up SetCursor() and it seems that I need to set the windows class cursor to NULL when creating the window otherwise, whenever the mouse is moved the cursor will reset to the class cursor (hence why my cursor is flickering between the default arrow and my double arrow one). Thats all fine and dandy in a win32 app because you specify what cursor to use. However, how do I do this in an mfc app? I can find no way to access/change that part of the dialogs window class. If I handle/override the PreCreateWindow() of the dialog I get access to some of the class items (i.e. style/position etc) however I cant find any way to change the class cursor. Can anyone tell me how I can get access to it to change it or if im doing something wrong? Thanks for your help

Share this post


Link to post
Share on other sites
Try handling WM_SETCURSOR and setting your cursor there. Dialogs have a window class that''s created by Windows, and it doesn''t appear you can create your own custom dialog class so that you can set a class cursor.

There was a recent thread on this with some more information.

Share this post


Link to post
Share on other sites