p3g4asus Posted January 19, 2008 Share Posted January 19, 2008 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 Quote Link to comment
UPollaehne Posted January 20, 2008 Share Posted January 20, 2008 Do you have a specific need to use DCOM? If you just want to access the DVBViewer on your local machine I would recommend to use com4j. Quote Link to comment
Moses Posted January 22, 2008 Share Posted January 22, 2008 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. Quote Link to comment
turmann Posted January 22, 2008 Share Posted January 22, 2008 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 Quote Link to comment
CiNcH Posted March 5, 2008 Share Posted March 5, 2008 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. Quote Link to comment
CiNcH Posted March 5, 2008 Share Posted March 5, 2008 (edited) 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 March 5, 2008 by CiNcH Quote Link to comment
Lars_MQ Posted March 5, 2008 Share Posted March 5, 2008 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. Quote Link to comment
CiNcH Posted March 5, 2008 Share Posted March 5, 2008 (edited) 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 March 5, 2008 by CiNcH Quote Link to comment
Lars_MQ Posted March 5, 2008 Share Posted March 5, 2008 normally you should be able to generate the stub directly from the exe. Wndows (and word, vb/c#/c++ etc) does it too. Quote Link to comment
CiNcH Posted March 5, 2008 Share Posted March 5, 2008 Thought so. I will try it and post the stub if I succeed. Quote Link to comment
CiNcH Posted March 5, 2008 Share Posted March 5, 2008 (edited) 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 March 6, 2008 by CiNcH Quote Link to comment
Rayman Posted March 5, 2008 Share Posted March 5, 2008 (edited) 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 March 5, 2008 by Rayman Quote Link to comment
tmielke Posted May 14, 2008 Share Posted May 14, 2008 (edited) 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 May 14, 2008 by tmielke Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.