Passing an interface pointer to a component
-
Hi, I have a vc++ application that has an interface IMyInterface and a class derived from this interface.I would like to pass a pointer to this interface, to an interface method declared in a component. I am trying to manually edit the header files and .idl file in order to declare the pointer to the interface declared in vc++ application. What I did is, I have included the vc++ app interface header file in the .idl file. I don't whether I can do this or not. But I am trying...When I did so, I am getting error "error MIDL2025 : syntax error : expecting a type specification near "virtual". Please let me know as how to pass my interface pointer to a method in the component and what are the changes that are to be made. Thanks in advance.
Taruni
-
Hi, I have a vc++ application that has an interface IMyInterface and a class derived from this interface.I would like to pass a pointer to this interface, to an interface method declared in a component. I am trying to manually edit the header files and .idl file in order to declare the pointer to the interface declared in vc++ application. What I did is, I have included the vc++ app interface header file in the .idl file. I don't whether I can do this or not. But I am trying...When I did so, I am getting error "error MIDL2025 : syntax error : expecting a type specification near "virtual". Please let me know as how to pass my interface pointer to a method in the component and what are the changes that are to be made. Thanks in advance.
Taruni
You can #include a .h file in MIDL to add structs etc, but in your case I think you need to #include the .idl file with the definition of the interface you want to pass e.g. #include "IMyInterface.idl" usually this is after the #import oaidl.idl #import ocidl.idl Your interface should then have a method (or similar): HRESULT PassMyInterface([in] IMyInterface* pIMyInterface);