Deye Posted May 5, 2018 Share Posted May 5, 2018 For anyone who would like to try this out, I want to deliberately make a ghost image of a last state (picture) GUI window which holds some info at it's exit time Just before its done doing its thing and exits it should leave a print of its own state on the screen at the same fixed location it usually shows up on (the script runs as as _Singleton hourly) with a F5 desktop refresh the image should then disappear The example for _WinAPI_PrintWindow() looks close enough on getting this done , with the example below I'm only setting the GUI as a BMP printed in to the GUI itself on a resize msg With my tries I couldn't yet get an image printed on to the screen, ..the Idea is to perhaps avoid the use of _WinAPI_DeleteObject deliberately once this is somehow resolved .. #include <GuiConstants.au3> #include <ScreenCapture.au3> Opt("PixelCoordMode", 0) $hGUI = GUICreate("My GUI", 400, 300, -1, -1, $WS_SIZEBOX) GUICtrlCreateButton("OK", 80, 100, 85, 25) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_RESIZED $tRect = _WinAPI_GetWindowRect($hGUI) $a = StringSplit(DllStructGetData($tRect, 1) & ',' & DllStructGetData($tRect, 2) & ',' & DllStructGetData($tRect, 3) & ',' & DllStructGetData($tRect, 4), ',', 1) $hBMP = _ScreenCapture_Capture("", $a[1] - 10, $a[2] , $a[3], $a[4], False) ; Draw bitmap to GUI _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0) ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hBMP) ; Shut down GDI+ library _GDIPlus_Shutdown() EndSwitch WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now