Solved

SetWindowRgn problem

Posted on 1998-08-18
1
360 Views
Last Modified: 2013-11-20
I need to change several times the shape of a window. I have two CRgn objects, and I pass an HRGN of that objects to a SetWindowRgn function. But the SetWindowRgn call, works only one time per object. After that, nothing happens. No error, no crash. I tryed to store the HRGN of the window first, but the machine crash.
0
Comment
Question by:wau
1 Comment
 
LVL 8

Accepted Solution

by:
Answers2000 earned 50 total points
ID: 1320964
1. You can't use the HRGN after you've called the SetWindowRgn API/Function.  From the help:
After a successful call to SetWindowRgn, the operating system owns the region specified by the region handle hRgn. The operating 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.

2. Once you've set the Rgn, any new regions are relative to this.  You need to reset the region to the entire window, if you want to set a new region.  Setting it to NULL should be enough.

3. Redraw parameter must be null.


4. Therefore to change the region do something like :
pWnd->SetWindowRgn( NULL, TRUE ) ; // remove old region
pWnd->SetWindowRgn( hrgn, TRUE ) ; // set new region
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 66
maxBlock challenge 30 100
sumNumber challenge 16 99
centeredAverage challenge 8 123
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now