Hi

I am stuck in my project, where we are basically using native interfaces with java using jni.

The requirement : There is a com dll provided for us and the document explaining its interfaces, let me call it as servercom.dll, which is basically using another general api, called as server api. I need to use the servercom.dll for getting the data from certain hardwares and pass it to the java for processing in a different application.

Where I AM now : The Java and C++ interfacing part is done, where i am creating my own dll file which inturn uses servercom.dll. my own dll is loaded in java using the system.loadlibrary. Basically interfacing with c++ is done. In c++ i am successfull in creating the instance of my required interface using ::cocreateinstance passing the CLSID objtained from servercom.dll .

Now the core issue is that, after creating my instances i need to do the even handling using connection points, where generally it will be taking IUnknown, but here they want IDispatch interface and they will be calling the even handler functions using idispatch :: invoke method. So i need to implement the IDispatch interface and pass it to the connection point. The twist is , for creating idispatch interface , it seems to be very complex as we cannot use midl compiler and idl files. because i am not using ms ide. but i am using the cl.exe compiler and link.exe linker for compiling and linking and creating the myown.dll. So i want your help in creating IDispatch interface in such a scenario.

they have implemented another classes for events specific for the interface like below

IAdaptorEvents : IDispatch{

virtual doWhatEvents(BSTR str) = 0;

virtual doWhatEverEvent(BSTR str) = 0;

}



so basically i need to create a class inheriting from this one like myAdaptorEventsListener : IAdaptorEvents - this point we need to implement 4 methods of IDispatch + 3 methods of IUnknown + the event Handler Methods(which is 2 in this case).

When implementing 4 Methods from IDispatch - GetTypeInfoCount and Get TypeInfo and Invoke and GetIDsof Names, i am totally lost here

as i need to creat ITypeInfo interface and lot of other things also. There was an example in MSDN http://msdn.microsoft.com/en-us/library/ms221237.aspx - where i am not getting NEARDATA, i dont know where they are declaring this. So in total Some one please let me know how to create an IDispatch interface by impolementing all those functions properly. and there are some stuffs like method id and all which i am not able to understand completely, May be because i am not a good c++ programmer. But my dear kind hearted friends please help me go ahead with this implementation. if you can show me a sample, i will be the happiest person in the world.

PS : I cannot use midl and idl files , please dont question me on the same, as that is a business decision. and it will always over ride the technical decisions

Any help appreciated and a hundres thanks

Regards

Althaf M