#Region
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>
#include <Date.au3>
Global Const $NONANTIALIASED_QUALITY = 3
Global $Hour, $Mins, $Secs
$Main_GUI = GUICreate("", 221, 194, 496, 325, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetBkColor(0xCCCCCC)
$Label2 = GUICtrlCreateLabel("", 16, 8, 188, 172, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetFont(-1, 15, 400, 0, "Arial", $NONANTIALIASED_QUALITY)
GUICtrlSetColor(-1, 0x00FF00)
GUICtrlSetData($Label2, '' )
$Labelcontext = GUICtrlCreateContextMenu($Label2)
$Font = GUICtrlCreateMenuItem("Шрифт", $Labelcontext)
$MenuPoyas = GUICtrlCreateMenuItem("Пояс", $Labelcontext)
$MenuInfo = GUICtrlCreateMenuItem("Справка", $Labelcontext)
$ExitClock = GUICtrlCreateMenuItem("Выход", $Labelcontext)
GUISetState(@SW_SHOW, $Main_GUI)
_WinAPI_SetLayeredWindowAttributes($Main_GUI, 0xCCCCCC, 0, $LWA_COLORKEY)
AdlibRegister("_SetTimeProc", 1000)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $ExitClock
Exit
sleep(200)
EndSwitch
WEnd
Func _SetTimeProc()
$sNewDate = _DateAdd( 'h',-6, _NowCalc())
$ZoneTime=_DateTimeFormat($sNewDate, 5)
$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
GUICtrlSetData($Label2, "владивосток "& @CRLF & @HOUR & ':' & @MIN & ':' & @SEC & @CRLF & "москва" & @CRLF & $ZoneTime )
EndFunc
Func ShowMenu($hWnd, $CtrlID, $nContextID)
Local $arPos, $x, $y
Local $hMenu = GUICtrlGetHandle($nContextID)
$arPos = ControlGetPos($hWnd, "", $CtrlID)
$x = $arPos[0]
$y = $arPos[1] + $arPos[3]
ClientToScreen($hWnd, $x, $y)
TrackPopupMenu($hWnd, $hMenu, $x, $y)
EndFunc
Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
Local $stPoint = DllStructCreate("int;int")
DllStructSetData($stPoint, 1, $x)
DllStructSetData($stPoint, 2, $y)
DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))
$x = DllStructGetData($stPoint, 1)
$y = DllStructGetData($stPoint, 2)
$stPoint = 0
EndFunc
Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
EndFunc