Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to access to com from c++.

biblbroxbiblbrox Member Posts: 1
I wrote a com object with ATL in VC++ 6.0 .
Now i need to call it from another application written in mfc and
i have no idea how to do it.
I have CoCreateInstance and CoInitialize but to call create instance i need to pass to it a pointer to the interface or at least that's what i think i should do and i have no idea from where to get it
or maybe i can call it in a much eaiser way whith one of the mfc classes i don't know.
Please Help.


Comments

  • ColdShineColdShine Member Posts: 597
    Maybe you can use #import or #include, look at the VC6 docs.
    _____________________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    http://www20.brinkster.com/coldshine[/size]

  • raminxraminx Member Posts: 4
    follow these steps:
    1- write "AfxOleInit();" in InitInistance of your CWinApp derived class; (this is the same as CoInitialize)
    2-invoke the class wizard,press the "add class.." button & select "from a type library", an open-file dialog is displayed.
    3-go to the directory of your atl project & select the *.tlb,a class representing you interface is imported.
    4-if the interface class is IZup, add a data member of this type to for example your CFormView class named m_zup.
    5-initialize this member this way:
    m_zup.CreateDispatch(szProgId); (check its return value)
    szProgId is an string representing your component,you can find it in the *.rgs file of you atl project in front of the entry: VersionIndependentProgID
    6- now you call members of the interface
    I hope it helps.
    Good Luck :)

Sign In or Register to comment.