Click here to Skip to main content
15,920,438 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralWhy... Pin
Frank Deo15-Jul-02 12:28
Frank Deo15-Jul-02 12:28 
GeneralRe: Why... Pin
Christian Graus15-Jul-02 12:31
protectorChristian Graus15-Jul-02 12:31 
GeneralRe: Why... Pin
Frank Deo15-Jul-02 12:35
Frank Deo15-Jul-02 12:35 
GeneralRe: Why... Pin
Christian Graus15-Jul-02 12:53
protectorChristian Graus15-Jul-02 12:53 
GeneralRe: Why... Pin
Frank Deo15-Jul-02 13:00
Frank Deo15-Jul-02 13:00 
GeneralRe: Why... Pin
Nish Nishant15-Jul-02 14:56
sitebuilderNish Nishant15-Jul-02 14:56 
GeneralGetting RuntimeClass of a CObject Derived Class Pin
MightyThor15-Jul-02 12:16
MightyThor15-Jul-02 12:16 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
Christian Graus15-Jul-02 12:34
protectorChristian Graus15-Jul-02 12:34 
There is a macro you need to include in your class for this stuff to be declared. I was forced to use this crap by a former employer, it is at best a hack. You should instead use dynamic_cast, which works for anything, not just CObject derived stuff.

CBand *selectedItem = dynamic_cast<CBand*>( m_treeMain.GetItemData( m_treeMain.GetSelectedItem() ));

if( selectedItem )
{
   AfxMessageBox( "so far so good" );
}


dynamic_cast returns NULL if the cast is invalid, otherwise the object requested. It also tells you at compile time if the cast you are attempting is unreasonable.

Christian

come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
Roman Fadeyev15-Jul-02 19:03
Roman Fadeyev15-Jul-02 19:03 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
Christian Graus15-Jul-02 19:13
protectorChristian Graus15-Jul-02 19:13 
GeneralRe: Getting RuntimeClass of a CObject Derived Class Pin
MightyThor15-Jul-02 23:35
MightyThor15-Jul-02 23:35 
Generalexcel automation, hprocess is not closing Pin
pnpfriend15-Jul-02 12:10
pnpfriend15-Jul-02 12:10 
Generalplease...... Pin
pnpfriend16-Jul-02 2:44
pnpfriend16-Jul-02 2:44 
GeneralRe: excel automation, hprocess is not closing Pin
Richard Ellis16-Jul-02 14:05
Richard Ellis16-Jul-02 14:05 
GeneralRe: excel automation, hprocess is not closing Pin
pnpfriend17-Jul-02 3:39
pnpfriend17-Jul-02 3:39 
Generalderive a class from my tree control Pin
Steve L.15-Jul-02 11:39
Steve L.15-Jul-02 11:39 
GeneralRe: derive a class from my tree control Pin
Joaquín M López Muñoz15-Jul-02 11:43
Joaquín M López Muñoz15-Jul-02 11:43 
GeneralRe: derive a class from my tree control Pin
Steve L.15-Jul-02 11:50
Steve L.15-Jul-02 11:50 
GeneralRe: derive a class from my tree control Pin
Joaquín M López Muñoz15-Jul-02 12:01
Joaquín M López Muñoz15-Jul-02 12:01 
GeneralRe: derive a class from my tree control Pin
Steve L.15-Jul-02 12:08
Steve L.15-Jul-02 12:08 
GeneralUsing CRecordset Pin
achandra00715-Jul-02 10:23
achandra00715-Jul-02 10:23 
GeneralRe: Using CRecordset Pin
Ranjan Banerji15-Jul-02 11:02
Ranjan Banerji15-Jul-02 11:02 
GeneralRe: Using CRecordset Pin
achandra00715-Jul-02 11:39
achandra00715-Jul-02 11:39 
GeneralComboBoxEx with DropList style problem Pin
Maciek Niedzielski15-Jul-02 10:10
Maciek Niedzielski15-Jul-02 10:10 
QuestionHow to make invisible CEdit visisble with code? Pin
ns15-Jul-02 10:09
ns15-Jul-02 10:09 

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.