Re: Variant encoded POINT

Stefan Zschocke <[email protected]> Fri, 22 Jul 2005 13:51:33 +0200
Newsgroups gmane.comp.windows.devel.jawin
Organization infoZoom
Message-ID <[email protected]>
Hi, VT_ARRAY is for indicating use of SAFEARRAY datatype (v.parray), not
for C++ style arrays.
Stefan
jacoZoom - Java/COM bridge for professionals.
www.infozoom.de


-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Schurer
Sent: Friday, July 22, 2005 1:08 PM
To: [email protected]
Subject: [JAWIN] Variant encoded POINT


I am having a problem with passing parameters to and from a dll. Using
the typebrowser I have generated classes to approach the dll. At the
moment my problem is that I try to call a function that has a single
parameter: a Variant in which a two-dimensional coordinate is encoded.

The relevant part of my code:

        IRoutePlanner rp = new IRoutePlanner();
        POINT p = new POINT();
        p.x = 135875;
        p.y = 452050;
        Variant v = new Variant();
        int punt[] = {p.x, p.y};
        v.pintVal = punt;
        v.vt = Variant.VT_I4 | Variant.VT_ARRAY;
        rp.setStartPoint(v);

This results in the following error message:

     [java] org.jawin.COMException: 8000ffff: passed end of stream in
the marshalling layer
     [java]     at org.jawin.marshal.GenericStub.dispatchInvoke0(Native
Method)
     [java]     at org.jawin.marshal.GenericStub.dispatchInvoke
(GenericStub.java:84)
     [java]     at org.jawin.DispatchPtr.putN(DispatchPtr.java:365)
     [java]     at org.jawin.DispatchPtr.put(DispatchPtr.java:245)
     [java]     at org.anwb.hv.geo.dll_types.IRoutePlanner.setStartPoint
(IRoutePlanner.java:260)
...

The function setStartPoint() has a Variant-encoded point as parameter. I
haven't found out how to construct such a parameter. Can someone explain
to me how I can do this? I couldn't find anything that helped me with
this in the mailing list.