Solved

SetWindowRgn problem

Posted on 1998-08-18
1
380 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sum28 challenge 31 117
Use of condition with 'serial' in ansible 2 88
wordcount challenge 11 148
Problem to App 4 122
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.

730 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