static void Main(string[] args) { try { MySystemTime sysTime = new MySystemTime(); LibWrapper.GetSystemTime(sysTime); Console.WriteLine("The System time is {0}/{1}/{2} {3}:{4}:{5}", sysTime.wDay, sysTime.wMonth, sysTime.wYear, sysTime.wHour, sysTime.wMinute, sysTime.wSecond); } catch (TypeLoadException e) { Console.WriteLine("TypeLoadException : " + e.Message); } catch (Exception e) { Console.WriteLine("Exception : " + e.Message); } }
public static extern void GetSystemTime([MarshalAs(UnmanagedType.LPStruct)] MySystemTime st);