I need to disable the close button on a window from another process. I have its handle in hWnd
and I try to do this:
DWORD dwCStyle = GetClassLongPtr(hWnd, GCL_STYLE);
SetClassLongPtr(hWnd, GCL_STYLE, dwCStyle | CS_NOCLOSE);
But that doesn't seem to have any effect on that window.
PS. I test this on Vista. Both processes don't run elevated.
PS2. I check the result both "visually" and by using Spy++. The hWnd
handle seems to point to the right window.