Click here to Skip to main content
16,004,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralBoot discs Pin
Dirso14-Mar-03 16:50
Dirso14-Mar-03 16:50 
GeneralRe: Boot discs Pin
Mike Nordell15-Mar-03 3:18
Mike Nordell15-Mar-03 3:18 
GeneralRe: Boot discs Pin
Dirso15-Mar-03 5:33
Dirso15-Mar-03 5:33 
GeneralPreliminary Research Question. Pin
73Zeppelin14-Mar-03 14:19
73Zeppelin14-Mar-03 14:19 
GeneralRe: Preliminary Research Question. Pin
Michael Dunn14-Mar-03 15:45
sitebuilderMichael Dunn14-Mar-03 15:45 
GeneralRe: Preliminary Research Question. Pin
73Zeppelin14-Mar-03 15:59
73Zeppelin14-Mar-03 15:59 
GeneralRe: Preliminary Research Question. Pin
Chris Richardson14-Mar-03 19:37
Chris Richardson14-Mar-03 19:37 
GeneralRegions Pin
georgiek5014-Mar-03 13:22
georgiek5014-Mar-03 13:22 
I am having a very difficult time understanding exactly how regions and region handles work. I noticed in 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."

I am wondering if this is the source of my problem. I have created an owner drawn button which is round and I have found some code to scan the bmp and make a region out of it using a transparent color setting. The button loads fine but minimizing the window and restoring it brings up the color that is supposed to be transparent.

Here is the code for my WM_DRAWITEM message:

case WM_DRAWITEM:

switch(pdis->CtlID)
{
	case ID_BUTTON: 
	     hdcMem = CreateCompatibleDC(pdis->hDC);
              SelectObject(hdcMem, hBitmapMin);
              SetWindowRgn(hwndMinimize, hMinRgn, TRUE);
	     BitBlt(pdis->hDC, 0, 0, 19, 19, hdcMem, 0, 0, SRCCOPY);
	     DeleteDC(hdcMem);
             
             break;
         ...
}


The same also happens if I click on the button but...I realized that if I omit the DeleteDC call then the button isn't altered by my clicking on it, only when minimizing. Another interesting fact is that despite the button being redrawn square the hotspot still remains in the original circle which means that the region I assigned is still there correct? But then why would the window be painted outside of it's region? Can anyone see any stupid mistakes I might be making? The code works perfect on the main application window, it's just giving me hell for my buttons. Thanks...?

P.S. The source for the region creation is here
GeneralAutomatic uninstall of previous install Pin
John R. Shaw14-Mar-03 12:21
John R. Shaw14-Mar-03 12:21 
GeneralCalling SHAppBarMessage from an NT Service Pin
Neflyte14-Mar-03 9:44
Neflyte14-Mar-03 9:44 
GeneralRe: Calling SHAppBarMessage from an NT Service Pin
Steve Schaneville14-Mar-03 9:50
professionalSteve Schaneville14-Mar-03 9:50 
GeneralRe: Calling SHAppBarMessage from an NT Service Pin
Neflyte15-Mar-03 5:31
Neflyte15-Mar-03 5:31 
QuestionStarting an MFC-based SDI app with window hidden. How? Pin
Steve Schaneville14-Mar-03 9:37
professionalSteve Schaneville14-Mar-03 9:37 
AnswerRe: Starting an MFC-based SDI app with window hidden. How? Pin
Michael Dunn14-Mar-03 10:08
sitebuilderMichael Dunn14-Mar-03 10:08 
GeneralRe: Starting an MFC-based SDI app with window hidden. How? Pin
Steve Schaneville14-Mar-03 10:41
professionalSteve Schaneville14-Mar-03 10:41 
QuestionDesign Pattern suggestions? Pin
Brian Shifrin14-Mar-03 9:03
Brian Shifrin14-Mar-03 9:03 
AnswerRe: Design Pattern suggestions? Pin
Neville Franks14-Mar-03 11:03
Neville Franks14-Mar-03 11:03 
Generalcombine integer and string Pin
AWebDude14-Mar-03 8:58
AWebDude14-Mar-03 8:58 
GeneralRe: combine integer and string Pin
Brian Shifrin14-Mar-03 9:07
Brian Shifrin14-Mar-03 9:07 
GeneralRe: combine integer and string Pin
AWebDude14-Mar-03 9:28
AWebDude14-Mar-03 9:28 
QuestionGoin Nuts --- Anyone DeInterlaced a YUV9 image? Pin
Scurtis14-Mar-03 8:49
Scurtis14-Mar-03 8:49 
AnswerRe: Goin Nuts --- Anyone DeInterlaced a YUV9 image? Pin
TomKat14-Mar-03 13:50
TomKat14-Mar-03 13:50 
AnswerRe: Goin Nuts --- Anyone DeInterlaced a YUV9 image? Pin
Chris Losinger15-Mar-03 4:00
professionalChris Losinger15-Mar-03 4:00 
GeneralRe: Goin Nuts --- Anyone DeInterlaced a YUV9 image? Pin
Anonymous17-Mar-03 5:23
Anonymous17-Mar-03 5:23 
GeneralOwner Drawn List Box Pin
georgiek5014-Mar-03 8:34
georgiek5014-Mar-03 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.