GetSystemTime example

In this category you can exchange your programming questions and solutions.
Post Reply
Angel
Posts: 87
Joined: Sat Nov 19, 2011 9:34 am

GetSystemTime example

Post: # 1180Post Angel
Mon May 12, 2014 1:55 pm

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

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

GetSystemTime example

Post: # 1181Post cvirus
Mon May 12, 2014 3:13 pm

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.

Angel
Posts: 87
Joined: Sat Nov 19, 2011 9:34 am

GetSystemTime example

Post: # 1182Post Angel
Wed May 14, 2014 9:50 am

Hello Cvirus,
fnxBasic does not support Dword.
GetSystemTime can be replaced with GetLocalTime.

Post Reply