#include <ComboConstants.au3>
#include <Date.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <SendMessage.au3>
#include <ButtonConstants.au3>
Global Const $iW = 350
Global Const $iH = 81
Global Const $gW = 464
Global Const $gH = 288
Global Const $hGUI = GUICreate("", $gW, $gH)
Global Const $bgc = "F0F0F0"
GUISetBkColor("0x" & $bgc, $hGUI)
Global Const $idPic = GUICtrlCreatePic("", 72, 40, $iW, $iH)
Global Const $bExit= GUICtrlCreateButton("Exit", 256, 150, 139,45)
GUICtrlSetImage(-1,"shell32.dll",15)
GUISetState(@SW_SHOW)
Global $nMsg
_GDIPlus_Startup()
Global $hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
$hBitmap = $hBitmap[6]
Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hContext, "int", 4)
_GDIPlus_GraphicsClear($hContext, "0xFF" & $bgc)
Timer()
AdlibRegister("Timer", 1000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $bExit
AdlibUnRegister("Timer")
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndSwitch
WEnd
Func Timer()
_GDIPlus_GraphicsDrawString($hContext, _NowTime(), 0, 0, "Arial", 50)
Local $hHBITAMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_WinAPI_DeleteObject(GUICtrlSendMsg($idPic, 0x0172, 0, $hHBITAMP))
_WinAPI_DeleteObject($hHBITAMP)
_GDIPlus_GraphicsClear($hContext, "0xFF" & $bgc)
EndFunc
|