Re: Outlook: Type Browser emits bad code

Stan Hughes <[email protected]> Thu, 11 Aug 2005 09:24:56 -0400
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <LISTSERV%[email protected]>
On Tue, 9 Aug 2005 11:42:07 -0400, Stan Hughes <[email protected]> wrote:

Since this post, I have found a answer to one of my problems, and a possible
solution to one, but, I wanted to ask someone who knew!!!


>twimc,
>
>I have used the type browser "Generate Full Code" on the (MS Outlook) file
>msoutl.olb. I know I do not need all this stuff to do what I am wanting,
>but, I thought "what the heck!"
>
>Anywho, I am finding about 90% of the files emitted have 1-3 errors that are
>keeping them from compiling... Can anyone tell me how to fix this, or, how I
>might be able to regen these files without the offending code? Any help is
>greatly appreciated...
>
>First error (found in almost EVERY file emitted):
>...
>    public int getClass() throws COMException
>    {
>        return ((Integer)get("Class")).intValue();
>    }
>...
>
>The error is: "The return type is incompatible with Object.getClass()"
>

Still don't have an anser for this one. I really don't know what this is
supposed to return. Do I need this method?

>
>
>Second error (not as common):
>...
>    public MailItem ForwardAsVcard() throws COMException
>    {
>      MailItem res = new MailItem();
>          DispatchPtr dispPtr = (DispatchPtr)invokeN("ForwardAsVcard", new
>Object[] {});
>          res.stealUnknown(dispPtr);
>          return res;
>
>    }
>...
>The error is: "The method stealUnknown is not defined for type XXX"
>Some types have this method (and there is no error) and some don't. Mostly,
>though, they don't (have the method).
>

I discovered that, on this code, changing MailItem to _MailItem fixed this
problem. It seems this error occurs only in regards to "Item" types, i.e.,
AppointmentItem, MailItem, ...


>
>
>Lastly, the third error I am seeing:
>...
>    public CommandBars getCommandBars() throws COMException
>    {
>        CommandBars res = new CommandBars();
>          DispatchPtr dispPtr = (DispatchPtr)get("CommandBars");
>          res.stealUnknown(dispPtr);
>          return res;
>    }
>...
>The error is: "CommandBars cannot be resolved"
>Where do I get CommandBars from?
>
>
>Thanks again, and, again, many thanks to the COM God that wrote this stuff!
>I'm not worthy!!!

I found CommandBars in MSO.DLL (or MSO.OLB, don't really remember - but it
was MSO.*).