Jump to content

(D)Com and java


p3g4asus

Recommended Posts

Attached you will find a small code snippet to get DVBViewer channel list from com interface with java. I uploaded the entire eclipse project folder. You will need j interop library (open source) for bi directional com in java. You can get it from:

http://sourceforge.net/projects/j-interop

I implemented also other code snippets to schedule and clear timers from com. The only problem in using com with java is that you cannot get running instance of DVBViewer (at least I couldn't). You need to create a new one and DVBViewer needs to be closed before. Other problem is that when you create a new instance of DVBViewer you will not see its window. It will run in background. That is not a big problem for batch works like scheduling timers.

 

I hope you enjoy. If you need any assistance or further explainations, please let me know.

Bye.

dvbviewer_com.zip

Link to comment

if you just like the java syntax and so on, then you may have a look at j# and the microsoft visual j# IDE. It comes with full support for COM and produces .NET Programs.

Link to comment

Hi,

 

that is a great idea. Im am a Java Developer, too. I often wondered to start writing a simple plugin but I wasn't able to motivate me to find a suitable IDE, learn a new programming language,...

 

Thanks to you and your tool it is much more likely that I start writing a useful tool for the DVBViewer :-)

 

 

Thanks

 

Tom

Link to comment
  • 1 month later...

Hi,

 

I am now looking into the COM and COM4J thing because I would like to receive some events from the DVBViewer.

 

The way I understand COM, it is pretty similar to CORBA which I am pretty familiar with. So what I am looking for at the moment is the platform and programming language independent DVBViewer COM type library to generate a Java stub. At least I think that I am looking for something like that.

 

Can anybody help me understand COM and what may be required in theory to communicate with the DVBViewer from a Java application? As I said I think I need a type library to generate a stub with COM4J.

Link to comment

DCOM (or j-interop) seems to be an option (seems to be using some kind of reflection to call methods). Still I would have to figure out how to receive events with it.

 

And still I wonder if there is some kind of DVBViewer COM type library. As a stub would be way more convenient then going the DCOM/j.interop reflection way...

Edited by CiNcH
Link to comment

the tlb is integrated into the DVBViewer.exe. Maybe there is a tool for java, which can create the necessary definitions for java. That's the way it works with delphi.

Link to comment

Yes, COM4J does exactly that. But I need the TLB file to generate the stub or may it be that I can generate it from the DVBViewer.exe? May be possible too...

Edited by CiNcH
Link to comment

Works like a charm.

 

Just the following problems...

C:\com4j-20080107>java -jar tlbimp.jar -o wsh -p test.wsh C:\Programme\DVBViewer\DVBViewer.exe
Generating definitions from DVBViewerServer
Unable to handle the type TfreedbReturnTrackData
 method Track
 interface IMusicCD
Unable to handle the type TfreedbReturnTrackData
 method Track
 interface IMusicCD
Unable to handle the type TMatch
 method Matchlist
 interface IFreeDB_HTTP

com4j_dvbvstub.zip

Edited by CiNcH
Link to comment
C:\com4j-20080107>java -jar tlbimp.jar -o wsh -p test.wsh C:\Programme\DVBViewer\DVBViewer.exe
Generating definitions from DVBViewerServer
Unable to handle the type TfreedbReturnTrackData
 method Track
 interface IMusicCD
Unable to handle the type TfreedbReturnTrackData
 method Track
 interface IMusicCD
Unable to handle the type TMatch
 method Matchlist
 interface IFreeDB_HTTP

Just for information:

 

I've had the same problem with Track/IMusicCD/IFreeDB_HTTP while generating C/C++ stubs. It took me a long time changing several things manually to fix this. Obviously there are some issues with these classes!?

 

Stefan.

Edited by Rayman
Link to comment
  • 2 months later...
Just for information:

 

I've had the same problem with Track/IMusicCD/IFreeDB_HTTP while generating C/C++ stubs. It took me a long time changing several things manually to fix this. Obviously there are some issues with these classes!?

 

Stefan.

 

Could you tell me what you did to get it running?

 

c:\users\tm1\projekte\lcddvbviewer\debug\DVBViewer.tlh(617) : error C3803: 'TMatch IFreeDB_HTTP::Matchlist[]': Eigenschaft hat einen Typ, der mit einem seiner Accessoren inkompatibel ist 'long IFreeDB_HTTP::GetMatchlist(VARIANT *)'

c:\users\tm1\projekte\lcddvbviewer\debug\DVBViewer.tlh(589): Siehe Deklaration von 'IFreeDB_HTTP::Matchlist':

__declspec(property(get=GetMatchlist)) struct TMatch Matchlist[];

c:\users\tm1\projekte\lcddvbviewer\debug\DVBViewer.tlh(617): Siehe Deklaration von 'IFreeDB_HTTP::GetMatchlist':

struct TMatch GetMatchlist ( long Index );
long GetMatchlist ( VARIANT * Value );

Edited by tmielke
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...