[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

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.
  • 2
1 Solution
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.
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.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now