Page 1 of 1

GetSystemTime example

Posted: Mon May 12, 2014 1:55 pm
by Angel
Record SYSTEMTIME
  wYear as word
  wMonth as word
  wDayOfWeek as word
  wday as word
  wHour as word
  wMinute as word
  wSecond as word
  wMilliseconds as word
End record
Declare GetSystemTime as "GetSystemTime" of "Kernel32"
  lpSystemTime as SYSTEMTIME
End Declare
Object frmForm as Form
  Caption="Form"
  Width=640
  Height=480
  Center
  `BorderStyle=BsDialog
  `Other objects
  Object btnButton as Button
    Tag=0
    Top=10
    left=10
    `Width=100
    `Height=30
    Caption="Button1"
    Hint="This is a button"
    ShowHint=True
    `Cursor=crHandPoint
    `Bitmap.loadFromFile("bitmap.bmp")
    OnClick=btnButton_OnClick
  End Object
  `End other objects
  `Onshow=frmForm_Onshow
  `Onclose=frmForm_Onclose
End Object
`frmForm.WindowState=WsMaximized
frmForm.Showmodal
Sub btnButton_OnClick
  dim hora as word, minutos as word, segundos as word
  GetSystemTime.Execute
  hora=GetSystemTime.lpSystemTime.whour
  Minutos=GetSystemTime.lpSystemTime.wMinute
  segundos=GetSystemTime.lpSystemTime.wSecond
  Showmessage str$(hora)+":"+str$(Minutos)+":"+str$(Segundos)
End Sub

GetSystemTime example

Posted: Mon May 12, 2014 3:13 pm
by cvirus
Thanks Angel, i not even knew that fnxbasic had word, this is working now, but to get your pc time you must change getsystemtime to getlocaltime in the api call

Does fnxbasic have also DWORD? 32 bits instead of 16 WORD?.

Thanks.

GetSystemTime example

Posted: Wed May 14, 2014 9:50 am
by Angel
Hello Cvirus,
fnxBasic does not support Dword.
GetSystemTime can be replaced with GetLocalTime.