Solved

How to eliminate flickering when using ShowWindow()

Posted on 2000-03-09
1
377 Views
Last Modified: 2013-11-20
Hi

  I need to show a series of dialog boxes.  I use ShowWindow() to hide a dialog box before showing the next one. However, i notice significant flickering and slow refreshing ( coz i can see glimpses of background applications) when i use this function .

Eg from Dialog Box 1 to Dialog Box 2

   ShowWindow(SW_HIDE);
   Dlg2.DoModal();
   ShowWindow(SW_SHOW);

   Any suggestions to the code or other methods to use??

  TIA
0
Comment
Question by:kc76
1 Comment
 
LVL 1

Accepted Solution

by:
mahno earned 50 total points
ID: 2603865
U can increase speed by following way:

Add to class for Dlg2:

class CClassName : public CDialog {
  //add class member
  CDialog *m_pParentDlg;  
  //...
  //add metdod
  void SetParentDlg(CDialog *pParentDlg);
}

//...

//Add string to constructor
void CClassName::CClassName() {
  //...
  //Initialize m_pParentDlg
  m_pParentDlg = NULL;
}

void CClassName::SetParentDlg(CDialog *pParentDlg) {
  m_pParentDlg = pParentDlg;
}

void CClassName::OnShowWindow(BOOL bShow, UINT nStatus) {
      CDialog::OnShowWindow(bShow, nStatus);
      
  if ((bShow == TRUE) && (m_pParentDlg != NULL))
    m_pParentDlg ->ShowWindow(SW_HIDE);
}

//Add this for OnClose, OnOk, etc.
void CClassName::OnClose() {
  //...
  if (m_pParentDlg != NULL)
    m_pParentDlg ->ShowWindow(SW_SHOW);
}


Hope this helps,
  mahno
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now