
If this isn’t possible, then I will consider using multiple if statements to check the hit test code, and set cursor’s look accordingly. So I ask the community to instruct me on how to do this. I really would like my WM_SETCURSOR handler to look like this: case WM_SETCURSOR: Looking through MSDN I have found link for hit test values ( ) and I have found link for cursor types ( ).Ĭurrently I am reading them, because I think that I will have to load additional cursor resources, take several comparisons of hit test values, and then use those resources to set cursor look accordingly. Looking through those, I have found an example where people compare low word of the lParam against hit test code. I have browsed through SO archive, looked on MSDN, CodeProject, DaniWeb, Cprogramming and CodeGuru, but had no success. If I comment out my WM_SETCURSOR handler, sizing arrows and cursor arrow appear properly, but cursor doesn’t change into hand when hovers above static control ( which is logical, since there is no WM_SETCURSOR handler to change it ). If I leave my WM_SETCURSOR handler unchanged, the only problem I get is that instead of sizing arrows, I get regular arrow ( as the cursor’s look ) when I hover over the border, but window can be sized. These set cursor to hand no matter where it is. Return DefWindowProc( hWnd, msg, lParam, wParam ) MY EFFORTS TO SOLVE PROBLEM:īellow are the code snippets that I have tried, but they all failed: I work on Windows XP, using MS Visual Studio C++ and pure Win32 API. If additional code snippets are required, ask and I will edit my post, but for now, they are omitted to keep the post short and concise.

If cursor hovers above static control, then my handler changes it to hand, else sets it to default cursor ( arrow ).īellow is the picture I have sketched in Paint that displays the desired look of the cursor when it hovers above static control, it is on the client area, and when user resizes window. If( (HWND)wParam = GetDlgItem( hwnd, 4000 ) )

This is my old WM_CURSOR handler ( code is simplified for clarity purposes ): case WM_SETCURSOR: HCursorArrow = LoadCursor( NULL, IDC_ARROW ) HCursorHand = LoadCursor( NULL, IDC_HAND )

This means that my handler for WM_SETCURSOR must be rewritten to reflect newly introduced changes.Ĭursors are loaded in WM_CREATE, and I have defined class cursor, like this: // cursors My initial application was in full screen mode, but recently terms have changed and it must have a resizable window. I have made an application that needs to change the look of a cursor into hand when mouse hovers above the static control, but resets it to a normal cursor otherwise.
