Jump to content
Sign in to follow this  
Merchants

GDIPlus Clean up problem

Recommended Posts

Merchants

hi

i have a img loadit in a GUI done it with:
 

_GDIPlus_StartUp()
GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")

Load_Img("any Pic", $GUI[0])

Sleep(1500)

_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_WinAPI_RedrawWindow($GUI[0])
Sleep(10)
DirRemove(@ScriptDir & "\Img_Folder\",1)

Func Load_Img($pic, $hwin)
    $hImage = _GDIPlus_ImageLoadFromFile($pic)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwin)
    _WinAPI_RedrawWindow($hwin)
EndFunc

Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    _WinAPI_RedrawWindow($GUI[0], 0, 0, $RDW_UPDATENOW)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 10, 75, 768, 576) ; Standaard Pal formaat
    _WinAPI_RedrawWindow($GUI[0], 0, 0, $RDW_VALIDATE)
    Return $GUI_RUNDEFMSG
EndFunc

but the image is located in a folder
if i want to delete the dir i said that the img file is in use by Autoit

what can i do?

 

Gr Merchants

Share this post


Link to post
Share on other sites
UEZ

_GDIPlus_ImageLoadFromFile($pic) locks the file! You have to dispose the handle before you can delete it.

But if you dispose it you cannot work with it!


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Merchants

_GDIPlus_ImageLoadFromFile($pic) locks the file! You have to dispose the handle before you can delete it.

But if you dispose it you cannot work with it!

and that can be done with this?

_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
Edited by Merchants

Share this post


Link to post
Share on other sites
UEZ

Yes, just after the Sleep line and don't forget _GDIPlus_Shutdown().


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Merchants

the problem is fixed

Thank you

Share this post


Link to post
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
Sign in to follow this  

×