Hlep One More Time Modeless Dialog

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Ravinder (ravinderhere_at_yahoo.com)
Date: 05/26/04


Date: 26 May 2004 08:23:04 -0700

Hi,

  please help out i have problem in SDI in the Main menu i am
calling Modeless Dilaog and the Menu function is in CView.cpp file

My Code in View

void CXXXXXXXXXView::OnMenuTest()
{
        CTestDialog1* m_dlg=NULL;
        if(m_dlg==NULL)
        {
                m_dlg=new CTestDialog1(this);
                m_dlg->Create(IDD_TEST_DIALOG1);

                m_dlgCheck=TRUE;

                if(m_dlgCheck==TRUE)
                {
                        m_dlg->ShowWindow(SW_SHOW);
                }
               }
        
         }
I am calling Modeless Dialog Box in above shown code, in Modeless
Dialog i have Button , the Button function is handled in Dialog.cpp
file in that Button Function i am calling a MainFrame function for
progress bar.So in my Button Function the source code looks like this

CXXXDialog::OnButtonFunc()
{
  CMainFrame* m_frm;
  m_frm->CallPBar(); // CallPBAR function is in MainFrame Thats why i
am calling function using pointer .
}

and in MainFrame.cpp file i have "CallPBar()" function which is used
to activate a progress bar inside a status bar of MainFrame.

the sourcecode looks like this
void CMainFrame::CallPBar()
{
        RECT MyRect;
        m_wndStatusBar.GetItemRect(1,&MyRect);
        if(m_frmCheck==FALSE)
        {
         m_progressBar.Create(WS_VISIBLE|WS_CHILD,MyRect,&m_wndStatusBar,1);
         m_progressBar.SetRange(0,100);
         m_progressBar.SetStep(1);
         m_frmCheck=TRUE;

         if(m_frmCheck==TRUE)
         {
          for(int i=0;i<100;i++)
          {
             Sleep(20);
             m_progressBar.StepIt();
          }
        }
      }
}

"m_frmCheck" is just BOOL Value in Mainframe.h file and i made all
intilisation as public ,so i am getting error at run time i am able to
go inside the function of "CallPBar()" ,by fixing with break point and
checking the source code but the control is unable to access the
memember variables of frame in above code in CallPBar() function.

 Before also i wrote my query and i am very great Thankfull to
"Mr.Scott McPhillips" for correcting my errors , but still i am not
finished with that work . i hope somebody understand my problem in
this world and solve my problem , if anybody have new ideas about my
problem they can guide me .
The Main Idea Behind this one is that i want to make a progress bar in
status
bar, when ever the user clicks a button inside the dilaog box, the
Progress bar should be activated.

So please help me to solve this problem.

I will be great Thankfull to who everbe in this world

waiting for your valuable response.

Ravi


Quantcast