Page 1 of 1

Syntax errors / Exception handling with COM+ interface

Posted: 2009-10-02T09:33:26-07:00
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 !

Re: Syntax errors / Exception handling with COM+ interface

Posted: 2010-03-29T12:10:33-07:00
by 99Percent
I am having this exact problem, please someone help.

Re: Syntax errors / Exception handling with COM+ interface

Posted: 2011-04-08T01:38:21-07:00
by Xandros
I finally decided to write a wrapper for MagickWand dll so I can juste do LoadLibrary and then call its functions...