Click here to Skip to main content
15,890,882 members
Home / Discussions / COM
   

COM

 
GeneralRe: VBScript and COM Pin
soptest21-May-02 7:24
soptest21-May-02 7:24 
GeneralRe: VBScript and COM Pin
Vivek Rajan21-May-02 9:16
Vivek Rajan21-May-02 9:16 
GeneralRe: VBScript and COM Pin
Jim Crafton23-May-02 16:57
Jim Crafton23-May-02 16:57 
GeneralRe: VBScript and COM Pin
Vivek Rajan23-May-02 18:16
Vivek Rajan23-May-02 18:16 
GeneralRe: VBScript and COM Pin
Jim Crafton24-May-02 3:08
Jim Crafton24-May-02 3:08 
GeneralRe: VBScript and COM Pin
Vi224-May-02 3:35
Vi224-May-02 3:35 
GeneralRe: VBScript and COM Pin
soptest24-May-02 7:16
soptest24-May-02 7:16 
QuestionCringeworthy Cast in ATL?? Pin
20-May-02 23:23
suss20-May-02 23:23 
I have created an ATL COM object in its interface I have a method that receives another interface of the same type and wish to modify some of its properties, however I do not want these properties to be exposed by its interface i.e. equivalent of protected member in C++ class.

I have the following code:


in header:

//this class ultimately derives from IMyComObject so
// I cast a IMyComObject* to CMyComObject*
class ATL_NO_VTABLE CMyComObject :
public CComObjectRootEx<ccomsinglethreadmodel>,
public CComCoClass<cmycomobject, &clsid_mycomobject="">,
public IDispatchImpl<imycomobject, &iid_imycomobject,="" &libid_mylib="">
{

....

protected:
IMyComObjectPtr m_pConnectedTo;


}

in method implementation:

STDMETHODIMP CMyComObject::ConnectTo(IMyComObject *pMyComObject)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())

IMyComObjectPtr pMyComObjectPtr = pMyComObject;

if ( m_pConnectedTo )
Disconnect();

if ( pMyComObjectPtr->IsConnected )
pMyComObjectPtr->Disconnect();

//////////this is the 'nasty' part it does work but I dont like it!!
//////////is there a more elegant way to achieve this or is what I am doing OK?
CMyComObject* pMyBodgeCast = dynamic_cast<cmycomobject*>(pMyComObject);
pMyBodgeCast->m_pConnectedTo = this;
//////////////////////////////////////////////////////////////////////////

m_pConnectedTo = pMyComObject;

return S_OK;
}

If anyone has any comments I would really like to hear them. Thanks.
AnswerRe: Cringeworthy Cast in ATL?? Pin
Vivek Rajan21-May-02 6:50
Vivek Rajan21-May-02 6:50 
GeneralRe: Cringeworthy Cast in ATL?? Pin
soptest21-May-02 7:41
soptest21-May-02 7:41 
GeneralRe: Cringeworthy Cast in ATL?? Pin
Vivek Rajan21-May-02 9:08
Vivek Rajan21-May-02 9:08 
GeneralRe: Cringeworthy Cast in ATL?? Pin
soptest21-May-02 10:32
soptest21-May-02 10:32 
GeneralRe: Cringeworthy Cast in ATL?? Pin
Vivek Rajan21-May-02 10:53
Vivek Rajan21-May-02 10:53 
GeneralRe: Cringeworthy Cast in ATL?? Pin
soptest21-May-02 12:10
soptest21-May-02 12:10 
GeneralRe: Cringeworthy Cast in ATL?? Pin
NotYourAverageGuy6-Jun-02 9:13
NotYourAverageGuy6-Jun-02 9:13 
GeneralRe: Cringeworthy Cast in ATL?? Pin
21-May-02 22:15
suss21-May-02 22:15 
GeneralRe: Cringeworthy Cast in ATL?? Pin
Vivek Rajan23-May-02 16:33
Vivek Rajan23-May-02 16:33 
GeneralCOM+ deployment help Pin
Annesa20-May-02 2:25
Annesa20-May-02 2:25 
GeneralRe: COM+ deployment help Pin
soptest20-May-02 9:40
soptest20-May-02 9:40 
Generaldrag and drop destination Pin
20-May-02 0:39
suss20-May-02 0:39 
GeneralRe: drag and drop destination Pin
soptest20-May-02 9:31
soptest20-May-02 9:31 
GeneralCannot expose interface Pin
Hans Ruck19-May-02 21:51
Hans Ruck19-May-02 21:51 
GeneralRe: Cannot expose interface Pin
soptest20-May-02 9:36
soptest20-May-02 9:36 
GeneralRe: Cannot expose interface Pin
Hans Ruck20-May-02 22:44
Hans Ruck20-May-02 22:44 
GeneralRe: Cannot expose interface Pin
Vi221-May-02 1:06
Vi221-May-02 1:06 

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.