Click here to Skip to main content
15,914,594 members
Home / Discussions / COM
   

COM

 
QuestionUsing COM library in a managed code without registration Pin
Alexander Kleshchevnikov29-Jan-06 13:11
Alexander Kleshchevnikov29-Jan-06 13:11 
QuestionAdding a new ColePropertyPage to a MFC ActiveX Pin
godspeed12328-Jan-06 6:02
godspeed12328-Jan-06 6:02 
QuestionCOM specification Pin
QuickDeveloper26-Jan-06 17:17
QuickDeveloper26-Jan-06 17:17 
AnswerRe: COM specification Pin
Gizzo26-Jan-06 21:30
Gizzo26-Jan-06 21:30 
QuestionHow to Pass c++ object across ATL DLL Pin
annjose2425-Jan-06 2:37
annjose2425-Jan-06 2:37 
AnswerRe: How to Pass c++ object across ATL DLL Pin
Stephen Hewitt25-Jan-06 22:23
Stephen Hewitt25-Jan-06 22:23 
GeneralRe: How to Pass c++ object across ATL DLL Pin
annjose2426-Jan-06 16:33
annjose2426-Jan-06 16:33 
GeneralRe: How to Pass c++ object across ATL DLL Pin
Stephen Hewitt26-Jan-06 16:56
Stephen Hewitt26-Jan-06 16:56 
It's possible, but the solutions are definately "twisted", I would suggest they are worse then the problem. You could do this:

// WARNING: POOR CODE - THIS NULLIFIES THE BENIFITS OF USING COM!
 
// Your class:
class clsA
{
public:
     clsB obj1; //class B obj
     clsC obj2; //class C obj
     char name[10];
     void show();
};
 
// In an IDL file:
HRESULT DirtyHack_PassInCPPObject([in]INT_PTR pObj);
 
// And in a .CPP file.
STDMETHODIMP CYouCOMObject::DirtyHack_PassInCPPObject(INT_PTR pObj)
{
     clsA* pA = reinterpret_cast<clsA*>(pObj);
 
     return S_OK;
}
 
// A call would look something like this:
clsA a;
spObj->DirtyHack_PassInCPPObject(reinterpret_cast<INT_PTR>(&a));


As you've probably guessed, I do not approve of this - But you wanted twisted. None of your coworkers will thank you for putting this in production code - If I were a manager I'd fire someone for doing so. COM objects written in any language can be called from any other language, this is one of the reasons for using COM. Breaking the rules like this destroys all this.

Steve
GeneralRe: How to Pass c++ object across ATL DLL Pin
annjose2426-Jan-06 17:07
annjose2426-Jan-06 17:07 
GeneralRe: How to Pass c++ object across ATL DLL Pin
Stephen Hewitt26-Jan-06 17:15
Stephen Hewitt26-Jan-06 17:15 
GeneralRe: How to Pass c++ object across ATL DLL Pin
annjose2426-Jan-06 17:25
annjose2426-Jan-06 17:25 
GeneralRe: How to Pass c++ object across ATL DLL Pin
Stephen Hewitt26-Jan-06 17:31
Stephen Hewitt26-Jan-06 17:31 
GeneralRe: How to Pass c++ object across ATL DLL Pin
annjose2426-Jan-06 18:15
annjose2426-Jan-06 18:15 
GeneralRe: How to Pass c++ object across ATL DLL Pin
Gizzo26-Jan-06 21:22
Gizzo26-Jan-06 21:22 
AnswerRe: How to Pass c++ object across ATL DLL Pin
Gizzo26-Jan-06 1:49
Gizzo26-Jan-06 1:49 
GeneralRe: How to Pass c++ object across ATL DLL Pin
annjose2426-Jan-06 16:36
annjose2426-Jan-06 16:36 
QuestionHelp with ENTRYID type and ENTRYLIST type Pin
Chris Meech24-Jan-06 10:40
Chris Meech24-Jan-06 10:40 
QuestionRe: Help with ENTRYID type and ENTRYLIST type Pin
Chris Meech26-Jan-06 7:15
Chris Meech26-Jan-06 7:15 
QuestionCOM DLL with IShellPropSheetExt Pin
souso2024-Jan-06 4:00
souso2024-Jan-06 4:00 
Questionsend error message to vb from c++ com Pin
mack scynox24-Jan-06 3:07
mack scynox24-Jan-06 3:07 
AnswerRe: send error message to vb from c++ com Pin
Gizzo24-Jan-06 5:00
Gizzo24-Jan-06 5:00 
GeneralRe: send error message to vb from c++ com Pin
mack scynox24-Jan-06 20:55
mack scynox24-Jan-06 20:55 
Questionprinter shell extension Pin
eisbaer311223-Jan-06 22:53
eisbaer311223-Jan-06 22:53 
AnswerRe: printer shell extension Pin
eisbaer31122-Feb-06 4:27
eisbaer31122-Feb-06 4:27 
QuestionICopyHook Pin
ragavan23-Jan-06 3:00
ragavan23-Jan-06 3:00 

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.