Set time and date from ATEASY
Raz A.
Haifa,

Jun 22, 2020
78 Posts

Set time and date from ATEASY

I am using ATEASY 7 142g in windows 7

i want to set date and time from ateasy code.
i know that there is cmd commands, but is there ateasy library that does the same thing?

And, is there a form\control for setting the time and date?

Solution Available
DrATEasy (Ron Y.)
Mission Viejo, CA

Sep 9, 2020
321 Posts

Re: Set time and date from ATEASY

Use the following code:

! open control panel applet to change date time and time zone
WinExec("timedate.cpl")

! set parent to the buttons form
Delay(1000)    ! let the window create before we can find it
h=FindWindow(0, "Date and Time")
SetWindowLong(h, -8, TestExec.GetCurrentForm().hWnd)

! disable current form
TestExec.GetCurrentForm().Enabled=False

! Wait until Date/time window closed
while IsWindow(h)
    DoEvents()
endwhile

! re-enable
TestExec.GetCurrentForm().Enabled=True


Where the following are decllared in TestExec.drv but in case you don't have them and using older version::

DLL User32
--------------------------------------------------------------------------------
    File = User32.dll
    ReloadOnStart = False
    LoadOnAccess = True
    Public = True

enumGetWindow: Enum Public
{
    GW_OWNER: Long Const = 4
}


Procedure IsWindow(hWnd): Bool Public
--------------------------------------------------------------------------------
    hWnd: Val AHandle

Procedure SetWindowLong(hWnd, lIndex, dwNewLong): Long Public Alias = SetWindowLongA
--------------------------------------------------------------------------------
    hWnd: Val AHandle
    lIndex: Val Long
    dwNewLong: Val DWord



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]