Click to See Complete Forum and Search --> : how to use the winapi32 in VB


ryan chan
June 2nd, 1999, 03:01 AM
How to use the winapi32 function GetSystemTime in VB?

public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime as SYSTEMTIME)

public Type SYSTEMTIME
wYear as Integer
wMonth as Integer
wDayOfWeek as Integer
wDay as Integer
wHour as Integer
wMinute as Integer
wSecond as Integer
wMilliseconds as Integer
End Type





Sub main()
Dim d as SYSTEMTIME
GetSystemTime (d)
MsgBox sp
End Sub




There is a compilation error when i run it
Compile error:
Variable required - can't assign to this expression

please help
Thanks!

Ravi Kiran
June 2nd, 1999, 03:47 AM
See my reply to your question in another thread.
This is because of the funny way in which VB interprets (). It means "evaluate this first"
The way out is
1. Use Call, like
Call GetSytemTime(d) ' Works fine
2.Or remove (). Just say
GetSytemTime d

Ravi