Click here to Skip to main content
15,891,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Eval Copy Pin
shiraztk19-Aug-04 1:53
shiraztk19-Aug-04 1:53 
GeneralRe: Eval Copy Pin
John M. Drescher19-Aug-04 2:08
John M. Drescher19-Aug-04 2:08 
GeneralRe: Eval Copy Pin
shiraztk19-Aug-04 2:55
shiraztk19-Aug-04 2:55 
GeneralRe: Eval Copy Pin
John M. Drescher19-Aug-04 4:53
John M. Drescher19-Aug-04 4:53 
GeneralRe: Eval Copy Pin
gamitech19-Aug-04 11:29
gamitech19-Aug-04 11:29 
GeneralRe: Eval Copy Pin
shiraztk19-Aug-04 20:12
shiraztk19-Aug-04 20:12 
GeneralIUnknown casting Pin
RChin19-Aug-04 0:34
RChin19-Aug-04 0:34 
GeneralRe: IUnknown casting Pin
Antti Keskinen19-Aug-04 0:55
Antti Keskinen19-Aug-04 0:55 
Actually, they don't.

The pointer pA points to a pointer to the interface class IA, which, according to COM rules, inherits from IUnknown, either directly or indirectly. However, it looks like you use the COM helper classes to declare IAPtr and IBPtr. When you do this, they can no longer be directly cast, but require explicit casting. To skip using COM helper classes, define the pointers in the following manner:
typedef IAPtr IA*
After this, you can no longer directly use them, but must instantate and initialize them manually. The prize is that they support direct casting.

The method you describe assumes a pointer to the IUnknown interface pointer. What you're passing it is a pointer to a pointer to IA. These two are not automatically compatible.

Using the following call would solve the case without extra work:
pB->SomeMethod( &(reinterpret_cast<IUnknown*>(pA)) );
-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: IUnknown casting Pin
RChin19-Aug-04 1:16
RChin19-Aug-04 1:16 
GeneralCString Pin
Johnny Peszek19-Aug-04 0:24
Johnny Peszek19-Aug-04 0:24 
GeneralRe: CString Pin
Antti Keskinen19-Aug-04 1:16
Antti Keskinen19-Aug-04 1:16 
GeneralRe: CString Pin
Johnny Peszek19-Aug-04 1:22
Johnny Peszek19-Aug-04 1:22 
GeneralRe: CString Pin
V.19-Aug-04 1:35
professionalV.19-Aug-04 1:35 
GeneralRe: CString Pin
Johnny Peszek19-Aug-04 1:43
Johnny Peszek19-Aug-04 1:43 
GeneralRe: CString and FYI Pin
V.19-Aug-04 2:18
professionalV.19-Aug-04 2:18 
GeneralUTF-8 to Unicode Pin
muthukumar_pandian19-Aug-04 0:19
muthukumar_pandian19-Aug-04 0:19 
GeneralRe: UTF-8 to Unicode Pin
Blake Miller20-Aug-04 4:55
Blake Miller20-Aug-04 4:55 
GeneralRe: UTF-8 to Unicode Pin
anderslundsgard30-Aug-04 2:07
anderslundsgard30-Aug-04 2:07 
GeneralRe: UTF-8 to Unicode Pin
Blake Miller30-Aug-04 6:18
Blake Miller30-Aug-04 6:18 
Generalcoledatetime formating time Pin
prasad_som19-Aug-04 0:09
prasad_som19-Aug-04 0:09 
GeneralRe: coledatetime formating time Pin
RChin19-Aug-04 0:44
RChin19-Aug-04 0:44 
GeneralRe: coledatetime formating time Pin
David Crow19-Aug-04 2:44
David Crow19-Aug-04 2:44 
Generalcreating help file Pin
Anonymous18-Aug-04 22:51
Anonymous18-Aug-04 22:51 
GeneralRe: creating help file Pin
David Crow19-Aug-04 2:54
David Crow19-Aug-04 2:54 
QuestionEfficient Thread Synchronization Object? Pin
aufeuer18-Aug-04 21:37
aufeuer18-Aug-04 21:37 

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.