Click here to Skip to main content
15,918,211 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Function Overloading Pin
smags1319-Mar-12 9:25
smags1319-Mar-12 9:25 
QuestionProblem with drawing using GDI functions... Pin
Rozis18-Mar-12 0:52
Rozis18-Mar-12 0:52 
XML
I've created an application that paints on the window using GDI functions. It works fine. But because it is still under development it sometimes craches. It seems that if there are certain craches Windows Vista suddenly decides to treat my application in a new way: while drawing on the window it decides it must redraw that was on the screen when i started my application. The effect is that some drawing is lost. Windows continues with this behavour till i reboot my pc. After i booted the same piece of code draws the window correctly. I used Spy++ to find out what's happening. When the window is correctly displayed i see the following:

<00037> 00340626 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:1215 yPos:640
<00038> 00340626 P WM_LBUTTONUP fwKeys:0000 xPos:1215 yPos:640
<00039> 00340626 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:1249 yPos:711
<00040> 00340626 P WM_LBUTTONUP fwKeys:0000 xPos:1249 yPos:711

(I press the mousebutton to start drawing, it draws the window, i press the mousebutton again to close the window)

When things go wrong Spy++ reports the following:

<00037> 00340626 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:1219 yPos:643
<00038> 00340626 P WM_LBUTTONUP fwKeys:0000 xPos:1219 yPos:643
<00039> 004904B2 S WM_WINDOWPOSCHANGING lpwp:0012FE20
<00040> 004904B2 R WM_WINDOWPOSCHANGING
<00041> 004F0646 S WM_WINDOWPOSCHANGING lpwp:0012FE20
<00042> 004F0646 R WM_WINDOWPOSCHANGING
<00043> 00340626 S WM_WINDOWPOSCHANGING lpwp:0012FE20
<00044> 00340626 R WM_WINDOWPOSCHANGING
<00045> 004904B2 S WM_WINDOWPOSCHANGED lpwp:0012FE20
<00046> 004904B2 R WM_WINDOWPOSCHANGED
<00047> 004F0646 S WM_WINDOWPOSCHANGED lpwp:0012FE20
<00048> 004F0646 R WM_WINDOWPOSCHANGED
<00049> 00340626 S WM_WINDOWPOSCHANGED lpwp:0012FE20
<00050> 00340626 S .WM_SIZE fwSizeType:SIZE_RESTORED nWidth:1280 nHeight:770
<00051> 00340626 R .WM_SIZE
<00052> 00340626 R WM_WINDOWPOSCHANGED
<00053> 004904B2 S WM_WINDOWPOSCHANGING lpwp:0012FE20
<00054> 004904B2 R WM_WINDOWPOSCHANGING
<00055> 004F0646 S WM_WINDOWPOSCHANGING lpwp:0012FE20
<00056> 004F0646 R WM_WINDOWPOSCHANGING
<00057> 00340626 S WM_WINDOWPOSCHANGING lpwp:0012FE20
<00058> 00340626 R WM_WINDOWPOSCHANGING
<00059> 00340626 P WM_PAINT hdc:00000000
<00060> 00340626 S WM_ERASEBKGND hdc:D1011D9A
<00061> 00340626 R WM_ERASEBKGND fErased:False
<00062> 00340626 S WM_GETICON fType:True
<00063> 00340626 R WM_GETICON hicon:1CA203B1
<00064> 00340626 S WM_GETICON fType:False
<00065> 00340626 R WM_GETICON hicon:00000000
<00066> 00340626 S WM_GETICON fType:True
<00067> 00340626 R WM_GETICON hicon:089A0417
<00068> 00340626 P WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:1252 yPos:726
<00069> 00340626 P WM_LBUTTONUP fwKeys:0000 xPos:1252 yPos:726

The big difference is lines numbered 39-67. Does anyone understand what's happening here? And what is a correct solution for this problem? What causes it? It seems that i have to intercept the paint message to tell Windows to shut up. But what worries me is that the hdc is 0. 

Any help will be appreciated..

AnswerRe: Problem with drawing using GDI functions... Pin
Albert Holguin18-Mar-12 17:09
professionalAlbert Holguin18-Mar-12 17:09 
QuestionSecure erase command implementation Pin
K4HVDs18-Mar-12 0:19
K4HVDs18-Mar-12 0:19 
AnswerRe: Secure erase command implementation Pin
jschell18-Mar-12 7:23
jschell18-Mar-12 7:23 
AnswerRe: Secure erase command implementation Pin
Albert Holguin18-Mar-12 17:28
professionalAlbert Holguin18-Mar-12 17:28 
QuestionMultiple threads in MFC Pin
K4HVDs18-Mar-12 0:15
K4HVDs18-Mar-12 0:15 
AnswerRe: Multiple threads in MFC Pin
Jochen Arndt18-Mar-12 1:23
professionalJochen Arndt18-Mar-12 1:23 
AnswerRe: Multiple threads in MFC Pin
Rajesh R Subramanian18-Mar-12 2:47
professionalRajesh R Subramanian18-Mar-12 2:47 
AnswerRe: Multiple threads in MFC Pin
Albert Holguin18-Mar-12 17:13
professionalAlbert Holguin18-Mar-12 17:13 
QuestionLittle advice of CFront Pin
Brandon-X1200017-Mar-12 17:13
Brandon-X1200017-Mar-12 17:13 
AnswerRe: Little advice of CFront Pin
Richard MacCutchan17-Mar-12 22:07
mveRichard MacCutchan17-Mar-12 22:07 
GeneralRe: Little advice of CFront Pin
Brandon-X1200017-Mar-12 23:22
Brandon-X1200017-Mar-12 23:22 
GeneralRe: Little advice of CFront Pin
Richard MacCutchan18-Mar-12 2:14
mveRichard MacCutchan18-Mar-12 2:14 
GeneralRe: Little advice of CFront Pin
Brandon-X1200018-Mar-12 6:39
Brandon-X1200018-Mar-12 6:39 
GeneralRe: Little advice of CFront Pin
Richard MacCutchan18-Mar-12 22:31
mveRichard MacCutchan18-Mar-12 22:31 
GeneralRe: Little advice of CFront Pin
Brandon-X1200020-Mar-12 10:09
Brandon-X1200020-Mar-12 10:09 
AnswerRe: Little advice of CFront Pin
markkuk18-Mar-12 0:08
markkuk18-Mar-12 0:08 
GeneralRe: Little advice of CFront Pin
Brandon-X1200018-Mar-12 6:45
Brandon-X1200018-Mar-12 6:45 
QuestionClassic console development kits in C, samples (Nintendo, Sega, Atari, Neo Geo, etc.)) Pin
smccd17-Mar-12 5:37
smccd17-Mar-12 5:37 
AnswerRe: Classic console development kits in C, samples (Nintendo, Sega, Atari, Neo Geo, etc.)) Pin
jschell17-Mar-12 7:50
jschell17-Mar-12 7:50 
AnswerRe: Classic console development kits in C, samples (Nintendo, Sega, Atari, Neo Geo, etc.)) Pin
Albert Holguin18-Mar-12 17:32
professionalAlbert Holguin18-Mar-12 17:32 
Questionweb-camera capture wite screen problem Pin
Member 873763117-Mar-12 5:35
Member 873763117-Mar-12 5:35 
Questionprime calculator Pin
Hassan Samee17-Mar-12 2:55
Hassan Samee17-Mar-12 2:55 
SuggestionRe: prime calculator Pin
Richard MacCutchan17-Mar-12 4:30
mveRichard MacCutchan17-Mar-12 4:30 

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.