Interfacing with an anonymous COM

Hello

First off, im a relative noob in regards to c++. Im a java programmer and a c++ hacker! i can make stuff work in c++ but im sure it aint pretty!

Scope of my issue;
My Java application needs to communicate with this COM object.

Obvious solution is using java JNI (Java Native Interface).
The procedure is, that you include some header in a cpp project that was autogenerated by the JNI tool, and thus makes a wrapper that communicates with the COM dll.

My problem starts right there.
In Visual Studio 2003, i have added the COM as a reference to my managed DLL project, but im unable to *use it*.
I do not have a lib or a header to go along with the COM.
I've used dumpbin to get an idea of what methods are available

I have a
#import "C:\\Programmer\\update.interface BTB 3.5\\MMInterfaceLib.dll"

wich yields a c1083 "cannot open type library". error. dunno if this is needed or not!


I have tried

      hr=CoGetClassObject(WASUUUUP,CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory,(void**)&pCf);
      hr=pCf->CreateInstance(NULL,IID_IUnknown,(void**) &pUnk);

wich does plain out not work!

and

     hInstLib = LoadLibrary("mmInterface.dll");
    functionptr=(LPFunctionType)GetProcAddress(hInstLib,"?CheckLogin@C_Portal@@IAEHH@Z");

wich does give me a reference, but alas, the rest of the method signature is unknown to me !

I've found some sites that describes a way to hack together a lib ... but while im allready in over my head, taking this step is sure to drown me at this moment....
Also, the login method i wanna execute is returning a complex type (struct i assume), wich i have no structural clue ablout! (except for seeing it briefely in some C# code weeks ago)



Ideas, suggestions ?

Please !!!!!! ...












LVL 1
CyTGAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hemakumarCommented:
In java to use a com component(u donot need to use JNI and functions like LoadLibrary and GetProcAddress).

U need to use typelibrary  wizard in java and select .tlb which inturn generates some wrappers of java.

It generates some thing like this for example.

public class sum extends java.lang.Object
{



}

public interface ISum extends com.ms.com.IUnknown
{



}

hope this will help u.
jkrCommented:
>>wich yields a c1083 "cannot open type library"

It seems that the DLL/TLB is not correctly registered on your system. Try

regsvr32 "C:\Programmer\update.interface BTB 3.5\MMInterfaceLib.dll"

on the command line

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CyTGAuthor Commented:
hemakumar -> im googling it, i assume that typlibrary is a product ? yet im having little success in locating this utility!

jkr -> I have infact allready done that, yet the result is what i described in my original post. Just to be sure that i havent fumbled along the way, i'll do it again (the dll comes with an installation wizard that does this for you, when it didnt work, i tried regsvr32 and it didnt improve the situation, as i recall, but ill give it another shot!)
CyTGAuthor Commented:
java type library -> javatlb -> VisualJ++ ... we're not developing in VS, however we do have some .net devs in the building (our setup is sun-java intellij idea, and a three tier model swing->j2ee(ejbs,webservices etc)->oracle.

But reading about it sounds promising!! http://docs.rinet.ru/ZhPP/ch20.htm

ill at latest monday with my results :)

Thx guys !!!!!!
CyTGAuthor Commented:
actually, the specifics about the wrapper were flawed, jkr were right ...
when so many steps are new/unknown/first time, im bound to make these typo-like-mistakes...

Thanks for the first round :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.