We help IT Professionals succeed at work.

Checking visibility of dialog?? Not so simple?

Haho asked
Last Modified: 2013-11-20
Hi guys, ... :) my problem is how to check if a dialog is visible( modal or non-modal ) . Easy, right?
Use IsWindowVisible...!! BUT I want to check it from another class and if possible , not by passing in
 pointers to the dialog object. Meaning, I want to use MFC function/s to get the object instance of the
dialog class with the id IDD_XXXXX and check whether that particulat object is visible or not, and/or call
the object's member functions. There should only be one object instance of that class at any one time...
simply, there will always be only one dialog of that particular class...

Thanks.... have a nice day!!

David Chong
Watch Question

Regardless of MFC, use the IsWindowVisible with the HWND.  HWND's are unique accross the system, not just to a process.

or if you have the HWND you do a

long x = GetWindowLong(hwnd);
if (x & WS_VISIBLE)
   /* its visible */
 /* its not visible */

Unlock this solution and get a sample of our free trial.
(No credit card required)


Thanks , sorry for the late reply... I was busy with my project...

There are cases where this solution won't work, but good luck anyways.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.