Link to home
Start Free TrialLog in
Avatar of kakamna
kakamna

asked on

Disbleing the Application While An Child Windows is Displayed

I am developing a MDI App. I created a Login window Dialog
Inherited by CFormView Now I want when i Display that windows
all the Menu and Application Options Should be Disabled Unless
windows is being ok or canceled. What Should I use to Disable.
Remember that I am not using Dialog class but CformView So
I can not Use DoModal of Dialog class.
Avatar of nil_dib
nil_dib

CWnd * pWnd = GetDlgItem(ID_BUTTON_1);
pWnd->EnableWindow(FASLE);

nil_dib
ASKER CERTIFIED SOLUTION
Avatar of Vinayak Kumbar
Vinayak Kumbar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kakamna

ASKER

Thank you Vine
But here is a probelm When I use this Code in Intial Update
Every Thing Become Disbaled Including the Window in which
I want to Get UserName and Password. Because after all it isthe
a chliuld fram of main Window drived from CFromVeiw
So what should I do
I want to disable everything except the login winfdow which is in front
Waiting for u r reply
Hi,

Yes !!!, I am sorry as I have not noticed it.
Well, I have some work around for it. Check it out.

In the App class, at the end (but before returning) in InitInstance() put the following code

m_pLoginTemplate->OpenDocumentFile(NULL);      
pMainFrame->SetMenu(NULL);
pMainFrame->m_wndToolBar.EnableWindow(FALSE);

here m_pLoginTemplate is the CMultiDocTemplate* for Ur login frame.

Here first line opens the login screen, then removes the menu(So that user is not allowed to select any menu items). Then disables the toolbar.

Then in the OnDestroy for ur login screen put the following code
((CMainFrame *)AfxGetMainWnd())  ->m_wndToolBar.EnableWindow(TRUE);

For this u have include MainFrm.h for that file and make the m_wndToolBar as public in MainFrm.h. That will solve the problem in one way.(But I am not satisfied).

But I feel best way to do this is using dialog box(that u too know).

Try it out.