Region Handles and GetWindowRgn
Posted on 2003-03-16
I recently started exploring the use of regions to skin my program but I am having a terrible experience with them. My current problem is concerning GetWindowRgn which always returns ERROR no matter what. I don't quite understand the following quote from MSDN:
"After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not close this region handle."
and the relationship it might have with my problem. Does this mean that as soon as you call SetWindowRgn the region handle is no longer valid and cannot be used anywhere else in the program yet not be deleted?
Using a fresh region handle as such:
always returns ERROR even though hwnd has been assigned a region previously in the program successfuly.
Calling GetLastError() gives me a value of 6 (ERROR_INVALID_HANDLE)
What could be the cause of this return value constantly and what are its workarounds?