Re: Outlook 2003

Morten Andersen <[email protected]> Sun, 17 Sep 2006 17:30:20 +0200
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <[email protected]>
Hi Edgar,

What happens if you instead use the code as described in "Introduction
to Jawin" section 4. "Calling a COM component using generated stubs"
(http://jawinproject.sourceforge.net/jawin.html#callingStubs ). I.e.
using a "new Integer(1)" instead of creating a "new Variant()".

I know the Javadoc for org.jawin.Variant is not particularly clear, but
if you look at the doc for org.jawin.Variant#writeObject you should find
some usefull information on how the different Java-types are marshalled.

Hope this helps you further.
Best Regards
Morten Andersen

Edgar Johnson wrote:

> Hi,
>
> I am getting an error when I try to access an Item in a generated Shapes class:
>
> org.jawin.COMException: 8000ffff: Unable to serialize variant: org.jawin.Variant@1833955
>         at org.jawin.Variant.writeVariant(Variant.java:347)
>         at org.jawin.Variant.writeObject(Variant.java:251)
>         at org.jawin.DispatchPtr.invokeN(DispatchPtr.java:579)
>         at org.jawin.DispatchPtr.invokeN(DispatchPtr.java:555)
>
> I think this may be a common problem.  Can you offer any suggestions?
>
> The code is going like this:
>
> ...
>       Ole32.CoInitialize();
>       _Application app = new _Application("PowerPoint.Application");
>       app.setVisible(1);
>       Presentations preses = app.getPresentations();
>       Presentation pres = preses.Add( -1 );
>       Slides slides = pres.getSlides();
>       Slide slide = slides.Add( 1, 2 );
>       Shapes shapes = slide.getShapes();//new Shapes();
>       Variant v = new Variant () ;
>       v.vt = VarTypes.VT_BYREF & VarTypes.VT_INT ;
>       v.byref = shapes ;
>       v.iVal = 1 ;
>       Shape shpText = shapes.Item( v );
> ...
> The runtime error is on last line.
>
> Thanks,
> Ed
> Josh Passenger <[email protected]> wrote: No experience with Outlook sorry, mailing list not so active at the moment..
>
> If you find bugs in the code generation stylesheets for the type browser and
> you are feeling adventurous, send a patch for the xsl file rather than
> hacking generated java then you won't have to hack it again later =]
>
> The fact that getClass methods are being generated indicates to me that we
> should be handling this in the stylesheets...
>
> What problems did you get with the mailing list?  Its a true list so you
> will only get new messages...
>
> Josh
>
>
>
>>Hello, I am trying to use jawin to interact with Outlook 2003. After using
>>the typebrowser on the OLB file, it generates java code, but the code
>>suffers from the same compiler errors as reported by Stan Hughes in
>>another thread (Thu, 11 Aug 2005 09:24:56 -0400). Luckily, he also
>>provided some suggestions on what to do with the errors. I have removed
>>all these methods: public int getClass() throws COMException. I take it
>>the error message means that class Object also has a method called getClass
>>(), which returns an Object, so you cannot override it returning an int. I
>>also added the underscores, like Stan suggests to get rid of the error:
>>The method stealUnknown is not defined for type XXX.
>>
>>In addition, I had some errors for missing object, such as Assistant and
>>ComAddIns. I removed the references to those as well. I first figured out
>>Assistant lives in Office.dll, but the typebrowser won't load that
>>particular dll for me. After that, the code compiles well.
>>
>>I would rather like it if someone who knows about these things, because I
>>do not, would confirm that this is the right way to go about it. And what
>>I would like even more is example code of how to access Outlook now. I can
>>get the Application object by instantiating _Application
>>(Outlook.Application), but what do I do now? I'd expect there to be a
>>method such as _app.getMailItems() or something like that, but there isn't
>>one. I would really appreciate example code for Outlook 2003, the more the
>>better.
>>
>>Finally, I'd like to say that I found this mailing list exceedingly hard
>>to join. All those emails that should come but don't!
>>
>>Many thanks for your help. If you have any expertise with Jawin and
>>Outlook, I'd much like to hear from you.
>
>
>
>
> <!--
>
> ---------------------------------
>  All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
>