|
Re: Variant arguments & com function calls: msg#00002windows.devel.jawin
We should probably add this to COMException or COMError (Why do we have both?) public static final int DISP_E_PARAMNOTFOUND = 0x80020004; For now you can use this to create a variant for optional arguments (code below not tried by me...): Variant missing = new Variant(); v.vt = VarType.VT_ERROR; v.scode = 0x80020004; If that works for you, then we should probably add public class Variant { ... public static final Variant MISSING = new Variant(); static { MISSING.vt = VarType.VT_ERROR; MISSING.scode = COMException.DISP_E_PARAMNOTFOUND; } So that you can use Variant.MISSING for optional VARIANT args. Robert -----Original Message----- From: Discussion of Java/Win32/COM integration with Jawin [mailto:JAWIN@xxxxxxxxxxxxxxxxxxx] On Behalf Of Morten Andersen Sent: Saturday, July 31, 2004 2:16 PM To: JAWIN@xxxxxxxxxxxxxxxxxxx Subject: Re: [JAWIN] Variant arguments & com function calls Hi Alex Alex Kotchnev wrote: [SNIP - well documented questions] > > > To summarize the questions questions: > 1. When there is a function that takes a Variant, which field in Variant > would have to be set ? I understand that maybe there is no general rule for > this, but at least a hint would be helpful... It should generally not be necessary to generate instances of org.jawin.Variant. Most (if not all) marshalling will be handled correctly by the automatic marshalling and the dispatch coercion mechanism. Eg. java.lang.Integer -> VT_UI4. I have recently refactored and documented a lot of this marshalling, so I suggest you try to check out the latest CVS-release by following the guidelines here http://jawinproject.sourceforge.net/jawindeveloper.html. Besides the javadoc for org.jawin.DispatchPtr and org.jawin.Variant you should check the docs/jawinuserguide_dispatch.html documentation (I have just made checkins 5 minutes ago, which should be available on the public CVS-server in approximately 5 hours). > 2. Is there an equivalent to the C# Type.Missing, or some other way to > indicate that the argument has to take its default value in the Com > function invocation ? We don't have that pt. You can try with "null", which get marshalled into VT_NULL, but I assume we need to marshal into VT_EMPTY to get this to work? But at least it sounds like it is something we have to support. Hope this helps you a little bit. And as a sidenote, as I don't know exactly what you are trying to do with Excel, but have you checked the POI project http://jakarta.apache.org/poi/, for writing/reading Excel files?. Best Regards Morten |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Error handling and thirdparty licenses (was: [JAWIN] JVM access violation in Type Browser): 00002, Morten Andersen |
|---|---|
| Next by Date: | Variant arguments & com function calls: 00002, Alex Kotchnev |
| Previous by Thread: | Error handling and thirdparty licenses (was: [JAWIN] JVM access violation in Type Browser)i: 00002, Morten Andersen |
| Next by Thread: | Re: Variant arguments & com function calls: 00002, Morten Andersen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |