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

C / C++ / MFC

 
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 
Heh I'm trying to stay on this sub-thread...

Here's my code (adjusted from yours) from my first response:

ShowWindow(SW_HIDE);// Hides CStartTransactionDlg
pMainWnd->UpdateWindow();
// And Now, on a Full Background:-
CCustomerAccountDlg Dlg(pCurrentCustomer,FLAG_SHOWACCOUNT|FLAG_ALLOWPAYMENT);
Dlg.DoModal();
pMainWnd->UpdateWindow(); // this one shouldn't be necessary, but WTH, it's cheap
ShowWindow(SW_SHOWNORMAL);// Show CStartTransactionDlg

If that's not enough then maybe a message pump is necesasary (I do this in my real-time video
software because I want windows completely drawn before starting video....it's more pleasing to
the users)
// Typical MFC message pump (global function or add to app class)
void _PumpWaitingMessages()
{
   MSG msg;
   while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) 
   { 
      if ( !AfxGetApp()->PumpMessage( ) ) 
      { 
         ::PostQuitMessage(0); 
         break; 
      } 
   }
}
 
...
 
CStartTransactionDlg::OnFindCustomer()
{
   ShowWindow(SW_HIDE);// Hides CStartTransactionDlg
 
   pMainWnd->UpdateWindow(); // Refreshes exposed part of background window
 
   _PumpWaitingMessages(); 
 
   // And Now, on a Full Background:-
   CCustomerAccountDlg Dlg(pCurrentCustomer,FLAG_SHOWACCOUNT|FLAG_ALLOWPAYMENT);
   Dlg.DoModal();
 
   pMainWnd->UpdateWindow();  // Refreshes exposed part of background window
 
   ShowWindow(SW_SHOWNORMAL);// Show CStartTransactionDlg 
}

*EDIT* Here's where the lengthy operation in OnInitDialog() comes in.
Normally, Dlg.DoModal(); will pump messages to refresh all the thread's windows.
If you do something lengthy in CCustomerAccountDlg::OnInitDialog(), though, then you have
interrupted the dialog's creation process and all those messages stuck in the queue don't
get processed - the dialog hasn't even entered the modal loop yet.
If this is the case, then I still recommend that within CCustomerAccountDlg, you post a user-
defined message to yourself (e.g. PostMessage(WM_STARTLENGTHYPROCESS)) from the end of
OnInitDialog() and in response to that message, start the lengthy process (instead of starting
the lengthy process from OnInitDialog()).

Mark



-- modified at 20:16 Tuesday 20th February, 2007


-- modified at 20:18 Tuesday 20th February, 2007

"Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot?
Of course you don't, no one does. It never happens. It's a dumb question... skip it."

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 
QuestionRe: How do I create 4 MDI child windows at start? Pin
Mark Salsbery19-Feb-07 13:16
Mark Salsbery19-Feb-07 13:16 
AnswerRe: How do I create 4 MDI child windows at start? Pin
Cengine19-Feb-07 13:24
Cengine19-Feb-07 13:24 
GeneralRe: How do I create 4 MDI child windows at start? Pin
Mark Salsbery19-Feb-07 13:51
Mark Salsbery19-Feb-07 13:51 
QuestionNeed printing help - How to print on 1/4 the part of A4 paper on dot-matrix printer Pin
anand_study19-Feb-07 7:37
anand_study19-Feb-07 7:37 
AnswerRe: Need printing help - How to print on 1/4 the part of A4 paper on dot-matrix printer Pin
Mark Salsbery19-Feb-07 12:11
Mark Salsbery19-Feb-07 12:11 
GeneralRe: Need printing help - How to print on 1/4 the part of A4 paper on dot-matrix printer Pin
anand_study19-Feb-07 16:27
anand_study19-Feb-07 16:27 
GeneralRe: Need printing help - How to print on 1/4 the part of A4 paper on dot-matrix printer Pin
Mark Salsbery20-Feb-07 5:47
Mark Salsbery20-Feb-07 5:47 
GeneralRe: Need printing help - How to print on 1/4 the part of A4 paper on dot-matrix printer Pin
anand_study21-Feb-07 23:37
anand_study21-Feb-07 23:37 
GeneralRe: Need printing help - How to print on 1/4 the part of A4 paper on dot-matrix printer Pin
Mark Salsbery22-Feb-07 5:28
Mark Salsbery22-Feb-07 5: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.