Solved

SetWindowRgn problem

Posted on 1998-08-18
1
385 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
[X]
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
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 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