Jump to content
Sign in to follow this  

GUICtrlSetImage Not loading past images.

Recommended Posts


I have a simple GUI which only holds an image.

Func _LoadImage($strImgLoc)
    GUICtrlSetImage($imageBox, $strImgLoc)
    $img_load = _GDIPlus_ImageLoadFromFile($strImgLoc)
    $img_initW = _GDIPlus_ImageGetWidth($img_load)
    $img_initH = _GDIPlus_ImageGetHeight($img_load)
    WinMove($gui_img, "", $winPos[0], $winPos[1], $img_initW, $img_initH)
    GUICtrlSetPos($imageBox, -1, -1, $img_initW, $img_initH)
    GUICtrlSetData($widthInput, $img_initW)
    GUICtrlSetData($heightInput, $img_initH)

Basically, all the GDIPlus stuff works properly but the SetImage function returns false every time I load a previously loaded image. Lets say I have 2 images, A.jpg and B.jpg. I now open A.jpg with my program. The image is shown in the window, the window is then resized to fit the image exactly, and it returns true. I load B.jpg, the exact same thing happens, it is shown and the window is resized properly. Now, I go and load A.jpg, the image is not loaded, it is just white/blank, the SetImage function has returned false. The window does however resize to the proper width and height of that image.

The only thing I can think of is destroying the image control, and recreating it each time...

Just tried that, it actually doesn't load the image either...

Edited by Joscpe


Share this post

Link to post
Share on other sites

Add _GDIPlus_ImageDispose($img_load) after you get the parameters.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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