Click here to Skip to main content
15,919,613 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: check the characters in a string Pin
Anu_Bala4-Sep-06 23:34
Anu_Bala4-Sep-06 23:34 
GeneralRe: check the characters in a string Pin
Hamid_RT5-Sep-06 0:58
Hamid_RT5-Sep-06 0:58 
AnswerRe: check the characters in a string Pin
velayudhan_raj4-Sep-06 19:42
velayudhan_raj4-Sep-06 19:42 
AnswerRe: check the characters in a string Pin
Hamid_RT4-Sep-06 20:10
Hamid_RT4-Sep-06 20:10 
QuestionHow to use the exports functions of control panel? Pin
Tcpip20054-Sep-06 19:20
Tcpip20054-Sep-06 19:20 
AnswerRe: How to use the exports functions of control panel? Pin
Michael Dunn4-Sep-06 20:21
sitebuilderMichael Dunn4-Sep-06 20:21 
GeneralRe: How to use the exports functions of control panel? Pin
Tcpip20054-Sep-06 23:01
Tcpip20054-Sep-06 23:01 
QuestionvalidateRect within CDialogBar Pin
IlanTal4-Sep-06 19:08
IlanTal4-Sep-06 19:08 
I have a strange problem within a CDialogBar. I need to paint some text in a different font, so I used a static box which I paint over. I capture the WM_PAINT message as OnPaint().

What I intended to do was invalidate the static box to cause a paint command, then inside the SetPatInfo() routine (inside the paint), validate the static box. There seems to be a timing problem as first my routine draws to the box and then another message comes along which updates the static box.

I can verify this by making the CDialogBar disappear from the screen and then reappear, in which case there is no invalid area and just my update is performed under the OnPaint().

I went farther to prove it by invalidating just 1/2 of the box in which case only 1/2 of the box is overwritten after I update it. My question is: why doesn't validateRect stop the second update and where is the second update coming from?

A solution to the problem is to update a single pixel in the corner of the box, but I want to know what is going on and why. Here are some code snippets:


void CMyToolbar::OnPaint()
{
CPaintDC dc(this); // device context for painting
SetPatInfo();
}

void CMyToolbar::Invalidate(void)
{
CWnd *wnd1;
CRect rc1;
wnd1 = GetDlgItem(IDC_PATINFO);
wnd1->GetClientRect(&rc1);
rc1.right /= 2; // for test, invalid 1/2 of rectangle
wnd1->InvalidateRect(rc1,0);
}

void CMyToolbar::SetPatInfo(void)
{
.....
wnd1 = GetDlgItem(IDC_PATINFO);
pDC = wnd1->GetDC();
.....
wnd1->GetClientRect(&rc1);
wnd1->ValidateRect(NULL); // NULL validates the whole window
sz1.cx = rc1.right;
sz1.cy = rc1.bottom;
br1.CreateSolidBrush(bkgColor);
pDC->FillRect(rc1, &br1);
.....
}

Any suggestions to telling me what is going on here would be appreciated.

Ilan

AnswerRe: validateRect within CDialogBar Pin
prasad_som4-Sep-06 19:25
prasad_som4-Sep-06 19:25 
AnswerRe: validateRect within CDialogBar Pin
IlanTal4-Sep-06 19:41
IlanTal4-Sep-06 19:41 
GeneralRe: validateRect within CDialogBar Pin
prasad_som4-Sep-06 19:57
prasad_som4-Sep-06 19:57 
QuestionNeed suggestion Pin
LaHaHa4-Sep-06 18:06
LaHaHa4-Sep-06 18:06 
AnswerRe: Need suggestion Pin
Steve Echols4-Sep-06 18:23
Steve Echols4-Sep-06 18:23 
GeneralRe: Need suggestion Pin
LaHaHa4-Sep-06 20:49
LaHaHa4-Sep-06 20:49 
GeneralRe: Need suggestion Pin
Steve Echols4-Sep-06 21:18
Steve Echols4-Sep-06 21:18 
GeneralRe: Need suggestion Pin
LaHaHa4-Sep-06 21:49
LaHaHa4-Sep-06 21:49 
Questionthe Dll I write under Window XP cannot be registered under Windows 2000. why? Pin
ewighell4-Sep-06 16:56
ewighell4-Sep-06 16:56 
QuestionRe: the Dll I write under Window XP cannot be registered under Windows 2000. why? Pin
prasad_som4-Sep-06 18:40
prasad_som4-Sep-06 18:40 
AnswerRe: the Dll I write under Window XP cannot be registered under Windows 2000. why? Pin
ewighell4-Sep-06 21:07
ewighell4-Sep-06 21:07 
GeneralRe: the Dll I write under Window XP cannot be registered under Windows 2000. why? Pin
prasad_som4-Sep-06 21:16
prasad_som4-Sep-06 21:16 
QuestionHow to detect the memory information in windows platform? Pin
HansonDavid4-Sep-06 16:31
HansonDavid4-Sep-06 16:31 
AnswerRe: How to detect the memory information in windows platform? Pin
prasad_som4-Sep-06 19:52
prasad_som4-Sep-06 19:52 
AnswerRe: How to detect the memory information in windows platform? Pin
Hamid_RT4-Sep-06 20:10
Hamid_RT4-Sep-06 20:10 
GeneralRe: How to detect the memory information in windows platform? Pin
HansonDavid5-Sep-06 2:25
HansonDavid5-Sep-06 2:25 
GeneralRe: How to detect the memory information in windows platform? Pin
Hamid_RT5-Sep-06 2:57
Hamid_RT5-Sep-06 2:57 

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.