CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 1999
    Posts
    9

    how to use the winapi32 in VB

    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!


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: how to use the winapi32 in VB

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured