By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,157 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,157 IT Pros & Developers. It's quick & easy.

Validate a MFC 'CDialog' handle

P: 3
I have a handle to MFC 'CDialog' and i need to check if handle valid (maybe dialog already destroyed) befor i used it (for example _myDld->ttt->IsWindowVisible() ) how can i validate this?
Aug 6 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,197
Most likely you will have created an object using the new operator.


Expand|Select|Wrap|Line Numbers
  1. MyDialogBox* ptr;
  2.  ptr = new MyDialogBox;
If so, as long as ptr is not zero you can assume the dialog box is still in existence.

I recommend using handles for this instead of pointers. There is an article in the C/C++ Articels section about handle classes.
Aug 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.