Sign in to follow this  
Followers 0
Sub

Delete GUI image window

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Stick with a single


When the words fail... music speaks

Share this post


Link to post
Share on other sites

I would except you can see that forum has 10x less activity then this one. That other one can be deleted if a mod wants to.

Share this post


Link to post
Share on other sites

That's just because in this forum can be posted a wide range of issues and there it's all about GUIs, nothing more. You would receive same attention there like here.


When the words fail... music speaks

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