Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: SEH exception translation bug Pin
Mark Salsbery20-Feb-07 6:42
Mark Salsbery20-Feb-07 6:42 
QuestionC++ Email project help Pin
arbster119-Feb-07 12:50
arbster119-Feb-07 12:50 
AnswerRe: C++ Email project help Pin
David Crow21-Feb-07 8:21
David Crow21-Feb-07 8:21 
QuestionMFC Force Painting Pin
Bram van Kampen19-Feb-07 12:49
Bram van Kampen19-Feb-07 12:49 
AnswerRe: MFC Force Painting [modified] Pin
Mark Salsbery19-Feb-07 13:06
Mark Salsbery19-Feb-07 13:06 
GeneralRe: MFC Force Painting Pin
Bram van Kampen19-Feb-07 13:46
Bram van Kampen19-Feb-07 13:46 
GeneralRe: MFC Force Painting Pin
Mark Salsbery19-Feb-07 13:53
Mark Salsbery19-Feb-07 13:53 
GeneralRe: MFC Force Painting [modified] Pin
Bram van Kampen19-Feb-07 15:16
Bram van Kampen19-Feb-07 15:16 
Hi Mark,

Thanks for your Interest. This is an issue that has caused bother for the last five years. I am trying to handle it head on now, without re-designing five years of code.

As an example, I have a Dialog Based App, which has a Maximised Window displaying a BMP as background. Message Handlers for the Dlg are typically as follows:-

void MyDialog::OnButton(){
.
.
.
COtherDlg Dlg;
ShowWindow(SW_HIDE);
LRESULT lRes=Dlg.DoModal();
ShowWindow(SW_SHOWNORMAL);
if(lRes==....
.
.
.
}


BOOL COtherDlg::OnInitDialog(){
CDialog::OnInitDialog();

DoSomethingVerryLengthy()
.
.
.
return TRUE;
}

The ShowWindow(SW_HIDE) causes the Entire App to disapear off the horizon, showing an Excell Worksheet, or whatever else is running one level lower on the Windows Stack. No Amount of UpdateWindow() InvalidateXXX() etc has got around this, I Keep seeing Excell for the Duration of
DoSomethingVerryLengthy().
Ofcourse, One solution is running things on Workerthreads, use Progress boxes, etc. Can be done, but I feel the overhead of this is unjustified if I can just find a way for the app to keep on filling the screen without showing Excell.
By the way, Tried your suggestion, by macroing in as follows:-

#define ShowWindow(X) ShowWindow(X);PaintMainWnd(X)
void PaintMainWnd(int SwType){

if(SwType!=SW_HIDE)return;

CWnd* pWnd=AfxGetMainWnd();
if(pWnd){
pWnd->InvalidateRect(NULL);
pWnd->UpdateWindow();
}
}
Still Seeing Excell, or in this case, the IDE

// By the way, Modified 1st because Poke tongue | ;-P seems to give a smiley face
//
// By the way, Modified 2nd to Re-assure that AfxGetMainWnd()
// Actually returns a Pointer to the Background Window.
// It's Paint Method is actually Called!
// in practice the screen is not actually painted.
// The thread appears to get blocked before the physical
// painting takes place. That's why I asked for a way
// to ensure that all physical painting takes place
// before I use the thread for 'DoSomethingVerryLengthy()'

Regards





-- modified at 21:25 Monday 19th February, 2007

LateNightsInNewry


-- modified at 21:49 Monday 19th February, 2007
GeneralRe: MFC Force Painting Pin
PJ Arends19-Feb-07 15:51
professionalPJ Arends19-Feb-07 15:51 
GeneralRe: MFC Force Painting Pin
Bram van Kampen19-Feb-07 16:04
Bram van Kampen19-Feb-07 16:04 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 5:21
Mark Salsbery20-Feb-07 5:21 
GeneralRe: MFC Force Painting Pin
Bram van Kampen20-Feb-07 13:23
Bram van Kampen20-Feb-07 13:23 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 13:30
Mark Salsbery20-Feb-07 13:30 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 5:41
Mark Salsbery20-Feb-07 5:41 
GeneralRe: MFC Force Painting Pin
Bram van Kampen20-Feb-07 12:14
Bram van Kampen20-Feb-07 12:14 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 12:31
Mark Salsbery20-Feb-07 12:31 
GeneralRe: MFC Force Painting [modified] Pin
Mark Salsbery20-Feb-07 14:06
Mark Salsbery20-Feb-07 14:06 
GeneralRe: MFC Force Painting Pin
Bram van Kampen21-Feb-07 14:11
Bram van Kampen21-Feb-07 14:11 
GeneralRe: MFC Force Painting Pin
Mark Salsbery21-Feb-07 14:23
Mark Salsbery21-Feb-07 14:23 
GeneralRe: MFC Force Painting Pin
Bram van Kampen20-Feb-07 13:33
Bram van Kampen20-Feb-07 13:33 
GeneralRe: MFC Force Painting Pin
Mark Salsbery20-Feb-07 13:49
Mark Salsbery20-Feb-07 13:49 
GeneralRe: MFC Force Painting Pin
Bram van Kampen19-Feb-07 13:50
Bram van Kampen19-Feb-07 13:50 
GeneralRe: MFC Force Painting Pin
Mark Salsbery19-Feb-07 13:55
Mark Salsbery19-Feb-07 13:55 
GeneralRe: MFC Force Painting Pin
Bram van Kampen19-Feb-07 15:23
Bram van Kampen19-Feb-07 15:23 
QuestionHow do I create 4 MDI child windows at start? Pin
Cengine19-Feb-07 12:43
Cengine19-Feb-07 12:43 

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.