Jump to content

Delete GUI image window


Sub
 Share

Recommended Posts

Thought Id try this here to see if I get any more suggestions.

Im trying to research the GUI side of Autoit and I made this little hotkey from snipits of scripts Ive seen on these forums that creates a picture and displays it on the screen. What problem I am having is I dont know exactly how to delete this window if I press the hotkey multiple times. Without deleting it, the script just makes multiple GUI windows.

This takes a picture at the mouse location called "shot.bmp" then displays it lower on your desktop. I just dont know how exactly to delete this window when I press the hotkey multiple times.

#include <ScreenCapture.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>


HotKeySet("{F8}", "Pic")
HotKeySet("{F11}","Terminate")

Local $GUIwidth = _GDIPlus_ImageGetWidth("Shot.bmp")
Local $GUIheight = _GDIPlus_ImageGetHeight("Shot.bmp")



Func Pic()
$pos = MouseGetPos()
_ScreenCapture_SetBMPFormat(0)
_ScreenCapture_Capture("Shot.bmp", $pos[0], $pos[1], $pos[0] + 30, $pos[1] + 30, 1)
$gui = GUICreate("", 150, 80, (@DesktopWidth/2)-100,@DesktopHeight-200,$WS_POPUP,$WS_EX_TOPMOST)
GUICtrlCreatePic("shot.bmp", 0, 0, $GUIwidth, $GUIheight)
GUISetState(@SW_SHOW)
EndFunc

while 1
sleep(10)
WEnd

Func Terminate()
Exit 0
EndFunc
Edited by Sub
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...