After messing around a little with making a GUI with the Windows API, I recently realized a problem with the cursor. When I compile and run my application, it shows a window like its supposed to. When I drag my cursor from the left side of my screen into my applications window, as it goes over the border it becomes the <-> thing for resizing but it remains like that anywhere inside my window. Same goes for if I bring it into the window from the bottom. The problem does not exist when I do from the right side though. I questioned if it was just my program so I went to the MSDN website and even compiled and tried their program (http://msdn.microsoft.com/en-us/library/ff381409%28v=VS.85%29.aspx). Same Problem! So then I started experimenting with the WM_SETCURSOR message and cursor functions but got nowhere.
Does anyone have any explanation to this and what I could do to fix it? Any help would be greatly appreciated.
After messing around a little with making a GUI with the Windows API, I
Share
Yes, that example code will behave as you describe because the
hCursormember ofWNDCLASSis set to zero, andWindowProc()doesn’t handleWM_SETCURSOR.If you want the same cursor all the time then it’s easiest to do something like this when setting up your window class:
If you want to have more control over the cursor then you want to leave
WNDCLASS::hCursorzero and callSetCursor()in response toWM_SETCURSOR. You’ll need to load/create your various cursors, and have some way of choosing the appropriate one based on your application’s state.