Click here to Skip to main content
15,916,842 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Question. Pin
Neville Franks21-Sep-03 0:02
Neville Franks21-Sep-03 0:02 
GeneralRe: C++ Question. Pin
Rickard Andersson2021-Sep-03 0:49
Rickard Andersson2021-Sep-03 0:49 
GeneralRe: C++ Question. Pin
Mike Dimmick21-Sep-03 1:13
Mike Dimmick21-Sep-03 1:13 
GeneralRe: C++ Question. Pin
WREY21-Sep-03 9:55
WREY21-Sep-03 9:55 
GeneralRe: C++ Question. Pin
Anonymous21-Sep-03 1:19
Anonymous21-Sep-03 1:19 
GeneralRe: C++ Question. Pin
WREY21-Sep-03 9:23
WREY21-Sep-03 9:23 
GeneralWinsock WSANETWORKEVENTS Pin
mweiss20-Sep-03 9:26
mweiss20-Sep-03 9:26 
GeneralPop-up menu artifact Pin
Luis Mejia20-Sep-03 9:07
Luis Mejia20-Sep-03 9:07 
I implemented a control (derived from CWnd) that implements a context menu. When the user selects something from the menu, the picture covering the whole control changes.

The picture is stored in an offscreen buffer and WM_PAINT only repaints the portion uncovered. I capture which item was chosen from the context menu right there with TrackPopupMenu and the TPM_RETURNCMD flag.

The problem is that when the pop-up context menu is disappearing it leaves some of itself on the control. The portion left behind is not of the same shape everytime.

While debugging I found this:

If, after a full control repaint (invalidating the whole control), I pop and hide the menu without any change to the control, the menu invalidates the area it was covering (let's call this Area A) and produces the artifact. From then on (as long as I don't issue a full control repaint), when I pop and hide the menu, it invalidates ONLY the area of itself that intersects with the area it 1st covered (Area A), making this new area Area A, and produces the artifact in this area only. So, if I pop and hide the menu making the intersection empty, it in fact doesn't invalidate anything and the artifact is not produced; Area A becomes empty and from then on there is no artifact until I invalidate the whole control, beginning this process again.

Note that the artifact does not cover all of Area A. As an example the artifact would be in the middle of Area A, which means WM_PAINT actually painted some of it (above and below).

Another fact is that if I delay the full control repaint for, let's say, 1 second, the artifact is not produced. But I don't want to delay anything.

If I move another window over the artifact, producing a WM_PAINT, it clears the artifact away.

I think the pop-up menu is somehow painting MY control's DC at the same time (as in concurrent threads) as my WM_PAINT. If this is the case, is there a way to prevent this?

Please help me! Any light on the issue will be greatly appreciated.

GeneralRegistry path from handle Pin
User 988520-Sep-03 7:55
User 988520-Sep-03 7:55 
GeneralRe: Registry path from handle Pin
David Crow20-Sep-03 17:01
David Crow20-Sep-03 17:01 
GeneralRe: Registry path from handle Pin
Jason Henderson20-Sep-03 17:54
Jason Henderson20-Sep-03 17:54 
GeneralProblem with Rich Edit Control Pin
raheela20-Sep-03 7:54
raheela20-Sep-03 7:54 
GeneralRe: Problem with Rich Edit Control Pin
Mike Dimmick20-Sep-03 12:54
Mike Dimmick20-Sep-03 12:54 
Generalproblem while using activeX control in regular dll using shared MFC DLL Pin
bhalchan20-Sep-03 5:57
bhalchan20-Sep-03 5:57 
Generalpassing data structures Pin
Sirrius20-Sep-03 5:09
Sirrius20-Sep-03 5:09 
GeneralRe: passing data structures Pin
Mike Dimmick20-Sep-03 12:59
Mike Dimmick20-Sep-03 12:59 
GeneralRe: passing data structures Pin
David Crow20-Sep-03 17:13
David Crow20-Sep-03 17:13 
GeneralRe: passing data structures Pin
Sirrius20-Sep-03 17:34
Sirrius20-Sep-03 17:34 
GeneralFile shredder Pin
alex.barylski20-Sep-03 4:58
alex.barylski20-Sep-03 4:58 
GeneralRe: File shredder Pin
JWood20-Sep-03 5:51
JWood20-Sep-03 5:51 
GeneralRe: File shredder Pin
Neville Franks20-Sep-03 12:24
Neville Franks20-Sep-03 12:24 
GeneralRe: File shredder Pin
alex.barylski21-Sep-03 20:29
alex.barylski21-Sep-03 20:29 
GeneralRe: File shredder Pin
ZoogieZork20-Sep-03 12:42
ZoogieZork20-Sep-03 12:42 
GeneralRe: File shredder Pin
alex.barylski21-Sep-03 20:31
alex.barylski21-Sep-03 20:31 
Generalswitch help Pin
coda_x20-Sep-03 1:28
coda_x20-Sep-03 1:28 

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.