michaelslamet Posted January 19, 2014 Posted January 19, 2014 Just wonder, why GUICtrlCreatePic doesn't display image after _GDIPlus_Startup() ? This code will not displaying example.gif: #include <GUIConstants.au3> #include <GDIPlus.au3> GUICreate("GUICtrlCreatePic Example", 200, 150, -1, -1) _GDIPlus_Startup () $file = @ScriptDir & "\example.gif" $image = _GDIPlus_ImageLoadFromFile($file) GUICtrlCreatePic($file, 1,1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd If we comment the "_GDIPlus_Startup ()" the example.gif will displayed perfectly.
BackHomeAgain Posted February 28, 2014 Posted February 28, 2014 I have the same problem with SplashImageOn. If I comment out _GDIPlus_Startup(), the image is displayed.
UEZ Posted February 28, 2014 Posted February 28, 2014 (edited) This is not _GDIPlus_Startup() related but _GDIPlus_ImageLoadFromFile() in connection with GUICtrlCreatePic(). The GUICtrlCreatePic() function returns 0 and set error = 1 but no documentation about error = 1. I cannot tell you yet why the image is not displayed. Br, UEZ Edited February 28, 2014 by UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Celtic88 Posted February 28, 2014 Posted February 28, 2014 #include <GUIConstants.au3> #include <GDIPlus.au3> GUICreate("GUICtrlCreatePic Example", 200, 150, -1, -1) $Ctrlpic = GUICtrlCreatePic('', 0, 0, 200, 150) _GDIPlus_Startup() $file = @ScriptDir & "\example.gif" $image = _GDIPlus_ImageLoadFromFile($file) $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($image) _GDIPlus_ImageDispose($image) _WinAPI_DeleteObject(GUICtrlSendMsg($Ctrlpic, 0x0172, 0, $hBMP)) ; thank to uez _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd
FireFox Posted February 28, 2014 Posted February 28, 2014 DjForfun, You are not solving the issue of the OP. michaelslamet, You need to dispose the image so it can be loaded again. ... $image = _GDIPlus_ImageLoadFromFile($file) _GDIPlus_ImageDispose($image) GUICtrlCreatePic($file, 1,1) ... Br, FireFox.
UEZ Posted February 28, 2014 Posted February 28, 2014 (edited) The question is not to find a workaround rather find the root cause. I assume that this is a bug within AutoIt. Br, UEZ Edited February 28, 2014 by UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
FireFox Posted February 28, 2014 Posted February 28, 2014 UEZ, This is not a workaround, can you tell me why if you use two different scripts the image can not be loaded using the GUICtrlCreatePic if it was previously loaded using _GDIPlus_ImageLoadFromFile (and not disposed).
UEZ Posted February 28, 2014 Posted February 28, 2014 (edited) If you swap these lines it works, too. $image = _GDIPlus_ImageLoadFromFile($file) GUICtrlCreatePic($file, 1,1)@FireFox: no. GUICtrlCreatePic is unfortunately a built-in function and not transparent.Edit: ops, wrong two lines selected. Br,UEZ Edited February 28, 2014 by UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
FireFox Posted February 28, 2014 Posted February 28, 2014 Of course it works because the GUICtrlCreatePic releases the image (deduction).
UEZ Posted February 28, 2014 Posted February 28, 2014 (edited) Ah, now I remember why it doesn't work. Because _GDIPlus_ImageLoadFromFile($file) is locking the file and GUICtrlCreatePic() cannot load it because it is locked by GDI+ function. No AutoIt bug! Br, UEZ Edited February 28, 2014 by UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
FireFox Posted February 28, 2014 Posted February 28, 2014 (edited) Yes (I meant you have to release it because it's locked) Edited February 28, 2014 by FireFox
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