Click here to Skip to main content
15,885,936 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have COM server that needs to talk to another COM server in the same process space.
I am using the ROT to setup access to the other COM server instance but suffered some unresolved externals for the one and only function I need to call. It was suggested that I import a tlb to supply the compiler with the necessary information so not having one I set off to make an ODL file that I could compile to the needed tlb.

The Class object is Cbcrshimcontrol
The member function I need to call is, static void MidiOutFromMaster(DWORD)

I made an ODL and am editing it to hopefully suit my needs but am having a time satisfying the MIDL compiler with respect to the member function. I am finding
not very much info when I google for it and all attempts to define the function produce:

error MIDL2349 : invalid member : MidiOutFromMaster [ Library 'Cbcrshimcontrol'

Here is my little ODL file so far.

C#
// oditest.odl : type library source for oditest.dll
// This file will be processed by the MIDL compiler to produce the
// type library (oditest.tlb).
[ uuid(F3120704-CF1B-4B96-AF60-B8610FEC4783), version(1.0) ] library Cbcrshimcontrol
{
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");
    static void MidiOutFromMaster(DWORD);
};


Thank you.

:Ron
Posted
Updated 16-Jun-11 12:29pm
v2

1 solution

you have to declare the interface that exposes that method (MidiOut...), and then include that interface in the library, within a coclass that exposes it

something like ...

MIDL
[
    object,
    uuid(<your itf GUID in here>),
    oleautomation,
    nonextensible,
    pointer_default(unique)
]
interface IyourMIDIinterface : IUnknown{

HRESULT MidiOutFromMaster([in] DWORD);

};
[
    uuid(F3120704-CF1B-4B96-AF60-B8610FEC4783),
    version(1.0),
]
library CbcrshimcontrolLib
{
    importlib("stdole2.tlb");

    [
        uuid(<your control lib guid>)
    ]
    coclass Cbcrshimcontrol
    {
        [default] interface IyourMIDIinterface;
    };


However, this should all be redundant - if you've got the source to the slave COM object, and it's a real COM object (i.e. created via an MFC or ATL wizard) you should have a type library kicking around somewhere ...

How did you create the slave com object?
 
Share this answer
 
Comments
Ron Anders 16-Jun-11 21:28pm    
Thank you very very much.

I am modifying some open source code for with oh 50% of the original code is still there. The only IDL came from the SDK for the DAW workstation software this all runs under. The original developer confessed to being better at good old C that ++ as am I so he may have not used the wizard. I'm going at the ODL backwards as I never had one.

Again, Thank you so much.

:Ron
barneyman 17-Jun-11 1:39am    
you may be able to use midl.exe to compile that IDL into a tlb ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900