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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CWnd * pWnd = GetDlgItem(ID_BUTTON_1);

Vinayak KumbarSr Program ManagerCommented:

Before poping up that view(means u can put this in OnInitialUpdate...) disable the main window. And after destroying the view enable the main window.

In OnInitialUpdate() for that form view put


And In OnDestroy() put

Thats it.

Hope this helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kakamnaAuthor Commented:
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
Vinayak KumbarSr Program ManagerCommented:

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


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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.