Click here to Skip to main content
15,887,979 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Turn of Ellipsis in ListView Pin
Prakash Nadar16-Mar-04 15:06
Prakash Nadar16-Mar-04 15:06 
GeneralRe: Turn of Ellipsis in ListView Pin
Anonymous16-Mar-04 15:19
Anonymous16-Mar-04 15:19 
GeneralRe: Turn of Ellipsis in ListView Pin
Steve S16-Mar-04 23:58
Steve S16-Mar-04 23:58 
GeneralRe: Turn of Ellipsis in ListView Pin
Rightoguy17-Mar-04 4:38
Rightoguy17-Mar-04 4:38 
Generalpublic member not working Pin
BlackDice16-Mar-04 10:22
BlackDice16-Mar-04 10:22 
GeneralRe: public member not working Pin
David Crow16-Mar-04 10:45
David Crow16-Mar-04 10:45 
GeneralRe: public member not working Pin
BlackDice16-Mar-04 10:50
BlackDice16-Mar-04 10:50 
GeneralC++ pointer question Pin
patnsnaudy16-Mar-04 10:20
patnsnaudy16-Mar-04 10:20 
If I have a pointer to an object foo is there anyway to tell if that object actually exists?

Say I only want one window open at a time.

void
foo::openWindow()
{
   static foo* ptr = NULL;
   if (ptr)  
      ptr->closeWindow();
   ptr = this;

   // open this window 
   ...
}

So, the second time through this code I want to know if ptr is still valid, because it may have been deleted without my knowledge.

I know there are other ways to do this, but I want to know if I can figure out if ptr still exists.

I've tried adding a ptr = dynamic_cast<foo*>(ptr);, but this throws an exception if ptr has been deleted, and I'd rather not use a try block.

Thanks in advance
GeneralRe: C++ pointer question Pin
Joe Woodbury16-Mar-04 10:55
professionalJoe Woodbury16-Mar-04 10:55 
GeneralRe: C++ pointer question Pin
patnsnaudy16-Mar-04 11:11
patnsnaudy16-Mar-04 11:11 
GeneralRe: C++ pointer question Pin
Christian Graus16-Mar-04 11:29
protectorChristian Graus16-Mar-04 11:29 
GeneralRe: C++ pointer question Pin
Ravi Bhavnani16-Mar-04 17:35
professionalRavi Bhavnani16-Mar-04 17:35 
GeneralRe: C++ pointer question Pin
TFrancis16-Mar-04 10:58
TFrancis16-Mar-04 10:58 
GeneralRe: C++ pointer question Pin
patnsnaudy16-Mar-04 11:02
patnsnaudy16-Mar-04 11:02 
GeneralRe: C++ pointer question Pin
David Crow17-Mar-04 3:03
David Crow17-Mar-04 3:03 
GeneralRe: C++ pointer question Pin
Christian Graus16-Mar-04 11:31
protectorChristian Graus16-Mar-04 11:31 
GeneralRe: C++ pointer question Pin
patnsnaudy16-Mar-04 12:55
patnsnaudy16-Mar-04 12:55 
GeneralRe: C++ pointer question Pin
Prakash Nadar16-Mar-04 14:55
Prakash Nadar16-Mar-04 14:55 
GeneralRe: C++ pointer question Pin
patnsnaudy17-Mar-04 3:56
patnsnaudy17-Mar-04 3:56 
GeneralRe: C++ pointer question Pin
Prakash Nadar17-Mar-04 16:45
Prakash Nadar17-Mar-04 16:45 
GeneralRe: C++ pointer question Pin
Ryan Binns16-Mar-04 17:10
Ryan Binns16-Mar-04 17:10 
GeneralI gave in (sln) Pin
patnsnaudy18-Mar-04 2:12
patnsnaudy18-Mar-04 2:12 
QuestionHow to TURN UNICODE ON. Pin
HAHAHA_NEXT16-Mar-04 10:19
HAHAHA_NEXT16-Mar-04 10:19 
AnswerRe: How to TURN UNICODE ON. Pin
David Crow16-Mar-04 10:34
David Crow16-Mar-04 10:34 
GeneralRe: How to TURN UNICODE ON. Pin
HAHAHA_NEXT16-Mar-04 10:39
HAHAHA_NEXT16-Mar-04 10:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.