Luigi Posted July 19, 2015 Share Posted July 19, 2015 (edited) 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 ;==>_updateIf 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).aspxThe @error 10 is FileNotFoundThe @extended I cant found... (yet)Someone can help-me to fix this error?Br, Luigi Edited July 19, 2015 by Luigi Visit my repository Link to comment Share on other sites More sharing options...
JohnOne Posted July 19, 2015 Share Posted July 19, 2015 It's possible that the folder in root drive needs admin permissions.You can easily test this by adding #RequireAdmin to your script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
LarsJ Posted July 19, 2015 Share Posted July 19, 2015 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. Luigi and Dan_555 1 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Luigi Posted July 19, 2015 Author Share Posted July 19, 2015 @LarsJ, you write, I clone the $hImage32 to other handle, and use ImageDispopose, ImageSave and ImageLoad again... It's odd, but work.Thank you! Visit my repository Link to comment Share on other sites More sharing options...
UEZ Posted July 20, 2015 Share Posted July 20, 2015 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 More sharing options...
Luigi Posted July 21, 2015 Author Share Posted July 21, 2015 I will check later, thanks UEZ. Visit my repository Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now