Abryce

gui parent & child display time

3 posts in this topic

i was wondering if anyone could please help me with this script iv been working on

iv been trying to get the date and time working on both of the gui's but everything iv tried doesn't work

 

#include <GuiconstantsEx.au3>
 #include <WindowsConstants.au3>
 #include <SendMessage.au3>
#include <DateTimeConstants.au3>
#include <Timers.au3>
#include <String.au3>
#include <GuiMenu.au3>
#include <ColorConstantS.au3>
#include <Date.au3>
#include <MsgBoxConstants.au3>


Opt('MustDeclareVars', 1)
Global $hGUI, $hMenu, $cMenu
    Global $hParentWin, $aParentWin_Pos, $hChildWin, $aMsg


HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{F1}", "Terminate")

MenuBarClock()
Func Terminate()
    Exit
EndFunc
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        ;;sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
 EndFunc


Func MenuBarClock()
   Local $msg, $filemenu, $openitem, $helpmenu, $iMenuCnt, $cMenuTimeItem, $hParentWin


    Local $iGUIWidth = 127, $iGUIHeight = 15

    ;Create main/parent window
    $hParentWin = GUICreate(_now(), $iGUIWidth, $iGUIHeight,1600, 15,$WS_POPUP)
     GUISetBkColor($COLOR_RED, $hGUI)
    ;Save the position of the parent window
    $aParentWin_Pos = WinGetPos($hParentWin, "")
    ;Show the parent window/Make the parent window visible
    GUISetState(@SW_SHOW)
$hChildWin = GUICreate(_now(), $iGUIWidth, $iGUIHeight,$aParentWin_Pos[0] - 220, $aParentWin_Pos[1] + 0, -1, -1,$hParentWin)
    ;$hGUI = GUICreate("X", 105, 15,1720, 15, $WS_POPUP,$hParentWin)
WinSetOnTop($hGUI, "", 1)
 GUISetBkColor($COLOR_RED, $hGUI)
 GUISetState(@SW_SHOW)
   ;GUICtrlCreateLabel($filemenu,0,0 )

GUISwitch($hParentWin)


$cMenu = GUICtrlCreateLabel(_now(),0,0)


    _Timer_SetTimer($hGUI, 1000, "_UpdateMenuClock"); create timer
    GUISetState()

    Sleep(2000)

    While 1
sleep(100)
    WEnd

EndFunc


Func _UpdateMenuClock($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu,_now())
EndFunc ;==>_UpdateMenuClock

 

Share this post


Link to post
Share on other sites



I not sure if you mean this:

Func _UpdateMenuClock($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu,_now())
    WinSetTitle($hChildWin,"",_now()) ;if you mean ChildWin title.
EndFunc ;==>_UpdateMenuClock

If you mean a label just set the label control ID. 

GUICtrlSetData($here_the_label_id_you_want_to_change,_now())
 
1 person likes this

 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

 thanks, just figured it out

 

i thought i need to use the gui parent and child to have 2 gui's to pop up and prob messed me up on trying to understand and get it working

this is what i was trying to get working,prob can also do it with parent and child window but its not needed.

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

 #include <GuiconstantsEx.au3>
 #include <WindowsConstants.au3>
 #include <SendMessage.au3>
#include <DateTimeConstants.au3>
#include <Timers.au3>
#include <String.au3>
#include <GuiMenu.au3>
#include <ColorConstantS.au3>
#include <Date.au3>
#include <MsgBoxConstants.au3>


; Create a GUI for the original image
Local $hGUI1 =GUICreate("X", 165, 17,1650, 12, $WS_POPUP,-1, WinGetHandle("Program Manager"))
WinSetOnTop($hGUI1, "", 1)
 GUISetBkColor($COLOR_RED, $hGUI1)
 GUISetFont(12)
GUISetState()

$cMenu = GUICtrlCreateLabel(StringFormat(_now()),0,0)
;$cMenu = GUICtrlCreateMenu(StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))


    _Timer_SetTimer($hGUI1, 1000, "_UpdateMenuClock"); create timer
    GUISetState()


; Create a GUI for the zoomed image
Local $hGUI2 = GUICreate("X2", 165, 17,1250, 12, $WS_POPUP,-1, WinGetHandle("Program Manager"))
WinSetOnTop($hGUI2, "", 1)
 GUISetBkColor($COLOR_RED, $hGUI2)
 GUISetFont(12)
GUISetState()

$cMenu2 = GUICtrlCreateLabel(StringFormat(_now()),0,0)

    _Timer_SetTimer($hGUI2, 1000, "_UpdateMenuClock2"); create timer
    GUISetState()


; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE



Func _UpdateMenuClock($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu,_now())
 EndFunc ;==>_UpdateMenuClock


Func _UpdateMenuClock2($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu2,_now())
EndFunc ;==>_UpdateMenuClock

 

Edited by abryce17
added "-1, WinGetHandle("Program Manager")" so Gui's dose not show in taskbar

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