Jump to content

GDIPlus Clean up problem


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

_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
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...