autoit _GDI 全屏桌面

 #NoTrayIcon
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
opt ("GUICloseOnESC",0)
HotKeySet("!{r}","_exit")
 
$sString = "休息中,请勿打扰!"
 
$hBitmap = _ScreenCapture_Capture ("")
 
$hGUI = GUICreate("scrren", @DesktopWidth,@DesktopHeight ,  0, 0,$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW,$WS_EX_APPWINDOW ))
GUISetState()
 
_GDIPlus_Startup ()
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)
 
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
 
$hGraphic2 = _GDIPlus_ImageGetGraphicsContext($hImage)
$hFamily  = _GDIPlus_FontFamilyCreate("Arial")
$hFont    = _GDIPlus_FontCreate($hFamily, 16, 1)
$tLayout  = _GDIPlus_RectFCreate(0, 0)
$hFormat  = _GDIPlus_StringFormatCreate(0)
$hBrush1  = _GDIPlus_BrushCreateSolid(0xA2FFFFFF)
$hBrush2  = _GDIPlus_BrushCreateSolid(0xC4FF0000)
$hPen     = _GDIPlus_PenCreate(0xC4000000, 2)
$aInfo    = _GDIPlus_GraphicsMeasureString($hGraphic2, $sString, $hFont, $tLayout, $hFormat)
$iWidth   = DllStructGetData($aInfo[0], "Width" )
$iHeight  = DllStructGetData($aInfo[0], "Height")
_GDIPlus_GraphicsFillRect($hGraphic2, 0, 0, $iWidth, $iHeight, $hBrush1)
_GDIPlus_GraphicsDrawRect($hGraphic2, 0, 0, $iWidth,$iHeight, $hPen   )
_GDIPlus_GraphicsDrawStringEx($hGraphic2, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2)
 
$aSlice = _GDIPlus_BitmapCloneArea($hImage,   0,   0,@DesktopWidth, @DesktopHeight,$GDIP_PXF64ARGB)
_GDIPlus_GraphicsDrawImage($hGraphic, $aSlice, 0, 0)
 
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
            _Exit()
        EndSwitch
WEnd
 
Func _exit()
; Free resources
_GDIPlus_ImageDispose   ($aSlice)
_WinAPI_DeleteObject    ($hBitmap  )
_GDIPlus_PenDispose         ($hPen    )
_GDIPlus_BrushDispose       ($hBrush1 )
_GDIPlus_BrushDispose       ($hBrush2 )
_GDIPlus_StringFormatDispose($hFormat )
_GDIPlus_FontDispose        ($hFont   )
_GDIPlus_FontFamilyDispose  ($hFamily )
_GDIPlus_GraphicsDispose    ($hGraphic)
_GDIPlus_GraphicsDispose    ($hGraphic2)
_GDIPlus_ImageDispose       ($hImage  )
_GDIPlus_ShutDown()
Exit
EndFunc

你可能感兴趣的:(职场,休闲,autoit,gdi,au3)