Getting CMyObj* from IMyInf* 
Author Message
 Getting CMyObj* from IMyInf*

Can I get a pointer to my class object from my interface pointer?

Thanks
Dell



Mon, 27 Oct 2003 04:17:53 GMT  
 Getting CMyObj* from IMyInf*
Hello Dell,

Quote:
> Can I get a pointer to my class object from my interface pointer?

It's not safe way and violates COM rules, however have a look at this
article:
"HOWTO: Get a C++ Class from an Interface Pointer in ATL"

--
Best regards,
Vadim Melnik,
{*filter*} Consultant.
_____________________________
http://www.*-*-*.com/



Mon, 27 Oct 2003 18:41:06 GMT  
 Getting CMyObj* from IMyInf*
In other words - this is a suicide, but here's the How-To guide :)...

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.*-*-*.com/
=====================================


Quote:
> Hello Dell,

> > Can I get a pointer to my class object from my interface pointer?

> It's not safe way and violates COM rules, however have a look at this
> article:
> "HOWTO: Get a C++ Class from an Interface Pointer in ATL"

> --
> Best regards,
> Vadim Melnik,
> {*filter*} Consultant.
> _____________________________
> http://www.*-*-*.com/



Tue, 28 Oct 2003 01:59:42 GMT  
 Getting CMyObj* from IMyInf*

Quote:

> Hello Dell,

> > Can I get a pointer to my class object from my interface pointer?

> It's not safe way and violates COM rules, however have a look at this article:
> "HOWTO: Get a C++ Class from an Interface Pointer in ATL"

See "ATL Internals" p.253 too. What a pity: such tricks may affect ATL debugging macros-
e.g. enabling _ATL_DEBUG_INTERFACES crashes the application...

Andrej



Sat, 13 Dec 2003 23:31:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. gets( ) gets crash

2. Gets() Considered Harmful (was: gets() messed up ?)

3. How do I play AVI file I'm getting from a socket (while I'm getting it)?

4. HELP - SQLHELPER code gets error on cmd.ExecuteNonQuery()

5. Getting a Type from a Class

6. Getting XML documentation to appear in assembly

7. Book for Getting Started in VS.Net?

8. Getting line numbers where exceptions occurs

9. HOWTO: Getting Custom Property Descriptions

10. getting a file from the app directory location

11. Getting current ROW information in DataGrid

12. Getting debug information from application to assembly

 

 
Powered by phpBB® Forum Software