Sign in to follow this  
Followers 0
JustinReno

GuiCtrlCreatePic(), _GDI+, InireadSection()

3 posts in this topic

For around an hour, I've tried to get my slideshow to work. Everything else works but creating the slideshow image. I've tried every combination I could think of to get the code to work. The image just doesn't display. Here is my redroducer:

#Include <GDIPlus.au3>
#Include <GUIConstants.au3>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;SYNTAX OF THE INI FILE:                     ;;;
;                                            ;;;
; [Picture Names and Paths]                  ;;;
; PictureName.jpg=ANY FULL PATH TO A PICTURE ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$Ini = @ScriptDir&"\Pictures.ini"
IniWrite($Ini, "Picture Names and Paths", "Merlin.gif", @SystemDir&"\oobe\images\merlin.gif")

_GDIPlus_Startup()
$ReadPicturePaths = IniReadSection($Ini, "Picture Names and Paths")
$SlideshowGUI = GUICreate("", @DesktopWidth + 100, @DesktopHeight + 100, -1 , -1, $WS_POPUP)
$Image = _GDIPlus_ImageLoadFromFile($ReadPicturePaths[1][1])
$SlideshowPicture = GUICtrlCreatePic($ReadPicturePaths[1][1], 100, 100, _GDIPlus_ImageGetWidth($Image)/3, _GDIPlus_ImageGetHeight($Image)/3)
GUISetState(@SW_SHOW, $SlideshowGUI)
While 1
    Sleep(100)
Wend

Please,Pleas, Please help :) THanks.

Share this post


Link to post
Share on other sites



No one knows?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When you _GDIPlus_ImageLoadFromFile, GDI+ locks the image file, so GUICtrlCreatePic() fails.

Do _GDIPlus_ImageDispose($Image) before trying to show image with GUICtrlCreatePic/GUICtrlSetImage, or draw pic using GDI functions and do not use these AutoIt functions at all.

Edited by Siao

"be smart, drink your wine"

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  
Followers 0