Jump to content

@error 10 on _GDIPlus_ImageSaveToFile


Recommended Posts

Hi, 

I load a png image at $hImage32

$sFile = "C:\Form\default.png"
$hImage32 = _GDIPlus_ImageLoadFromFile($sFile)

This $hImage32 is showed in $hBackbuffer
 

Func _update()
    _GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
    _GDIPlus_GraphicsDrawImageRectRect($hBackbuffer, $hImage32, 0, 0, 32, 32, 0, 0, 32, 32)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, 32, 32)
EndFunc   ;==>_update

If a error in _update(), ignore... the main question is: I can save the image it is still showed?

Or clear the draw and save?

Whe I call a function to shave $hImage32 the, occur this error:

$TRY = _GDIPlus_ImageSaveToFile($hImage32, $sFile)
_GRID_Save( $hImage32[ 0x02C09480 ] $sFile[ C:\Form\default.png ] $TRY[ False ] @error[ 10 ] @extended[ 7 ] FileExists[ 1 ])

Conform https://msdn.microsoft.com/en-us/library/windows/desktop/ms534175(v=vs.85).aspx

The @error 10 is FileNotFound

The @extended I cant found... (yet)

Someone can help-me to fix this error?

Br, Luigi

Edited by Luigi

Visit my repository

Link to comment
Share on other sites

I'm pretty sure that _GDIPlus_ImageLoadFromFile keeps the file open until the image is released with _GDIPlus_ImageDispose. That's the reason for the error.

Link to comment
Share on other sites

It's not odd because as long as the image is loaded and not disposed the image is locked by gdiplus!

Theoretically it should work when you load the file as binary string using:

_GDIPlus_BitmapCreateFromMemory(Binary(FileRead($sFile))

I didn't check it yet...

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...