It works great, but without the MsgBox line, the image will appear and then disappear instantly.
I get that the Gui, Destroy line is doing that, but what I want to do is pause processing until the user closes the gui (either by pressing the top right 'X' close button, or by a button on the gui control if anyone knows how to do that?).
Does anyone know how to do some kind of pause-processing option so as not to do the Gui, Destroy until the user presses a button to proceed?
Code: Select all
ShowImage(imagepath, imagetitle)
{
Gui, +Resize
Gui, Add, Pic, xm vPic
if imagepath =
return
Height := A_ScreenHeight - 100
Width := -1 ; -1 is "Keep aspect ratio"
GuiControl, , Pic, *w%width% *h%height% %imagepath% ; Load the image.
Gui, Show, x0 y0 AutoSize, %imagetitle% ; Resize the window to match the picture size. ; xCenter puts in middle screen!
MsgBox, , Press OK to close image, Press OK or Enter to leave this image.
Gui, Destroy
WinWaitClose
; ;-----------------------------------
; ; event handlers
; ;-----------------------------------
; ButtonOK: ; "OK" button, {Enter} pressed
; Gui, Destroy
; Return
;
; ButtonCancel: ; "Cancel" button
; GuiClose: ; {Alt+F4} pressed, [X] clicked
; GuiEscape: ; {Esc} pressed
; Index := 0
; Gui, Destroy
; Return
}