Syntax errors / Exception handling with COM+ interface

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
Xandros
Posts: 28
Joined: 2009-10-02T09:19:49-07:00
Authentication code: 8675309

Syntax errors / Exception handling with COM+ interface

Post by Xandros »

Hello,

I'm trying to integrate the ImageMagickObject COM+ interface with a test app written in Delphi.

Everything works wonders, but I can't seem to find a way to properly handle exceptions and syntax errors.

Let's say in a similar VB sample I call

Code: Select all

msgs = img.Convert("logo:","-resize","15a0x151","-format","%w","PNG24:logo.png")
no image is output on disk, which is normal since there is a syntax error in the "15a0x151" parameter.

However, I can't seem to find a way to do proper exception/error handling for such a case When something really goes wrong with COM+, then Err.Number is updated (or an Exception is thrown in Delphi), but if there is a syntax error or a missing param or something in the actual IM commandline, the call just silently fails without throwing any exceptions/errors.

The only thing I've found is to output the width of the result image and then check if msgs is > 0, then I can assume my convert succeeded.

Also, calling retrieving the "Messages" property of the COM interface results in "Not Implemented" message ...

Is there a clean way to do proper exception handling with the COM interface like with other programmatic interfaces (like retrieving error codes and so on http://www.imagemagick.org/script/exception.php)

Thanks !
99Percent

Re: Syntax errors / Exception handling with COM+ interface

Post by 99Percent »

I am having this exact problem, please someone help.
Xandros
Posts: 28
Joined: 2009-10-02T09:19:49-07:00
Authentication code: 8675309

Re: Syntax errors / Exception handling with COM+ interface

Post by Xandros »

I finally decided to write a wrapper for MagickWand dll so I can juste do LoadLibrary and then call its functions...
Post Reply