Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SetWindowRgn problem

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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