Sign in to follow this  
Followers 0

_ScreenCapture_SaveImage wrong return value

2 posts in this topic

Posted

Hi developers!

I have problems with the function _ScreenCapture_SaveImage().

It returns False and sets @error to 1, if the save operation was successful.

I believe the problem is in the last line:

$iResult = _GDIPlus_ImageSaveToFileEx($hImage, $sFileName, $sCLSID, $pParams)
...
Return SetError($iResult, 0, $iResult = 0)

_GDIPlus_ImageSaveToFileEx returns True=successful; False = failure.

This return value is inverted and returned by _ScreenCapture_SaveImage.

I changed the code to:

Return SetError($iResult=False, 0, $iResult = True)

and now it seems to work fine.

Maybe there are other functions in ScreenCapture like this, but I didn't checked.

Kind regards,

Christian

Share this post


Link to post
Share on other sites



Posted

Hi developers!

I have problems with the function _ScreenCapture_SaveImage().

It returns False and sets @error to 1, if the save operation was successful.

I believe the problem is in the last line:

$iResult = _GDIPlus_ImageSaveToFileEx($hImage, $sFileName, $sCLSID, $pParams)
...
Return SetError($iResult, 0, $iResult = 0)

_GDIPlus_ImageSaveToFileEx returns True=successful; False = failure.

This return value is inverted and returned by _ScreenCapture_SaveImage.

I changed the code to:

Return SetError($iResult=False, 0, $iResult = True)

and now it seems to work fine.

Maybe there are other functions in ScreenCapture like this, but I didn't checked.

Kind regards,

Christian

Thanks, Fixed.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0