Outlook: Type Browser emits bad code

Stan Hughes <[email protected]> Tue, 9 Aug 2005 11:42:07 -0400
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <LISTSERV%[email protected]>
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()"



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).



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!!!