Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than Structures, prefix the name with the module name and a period.
SYSTEMTIME (Structures)
.
C# Definition:
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct SYSTEMTIME
{
[MarshalAs(UnmanagedType.U2)] public short Year;
[MarshalAs(UnmanagedType.U2)] public short Month;
[MarshalAs(UnmanagedType.U2)] public short DayOfWeek;
[MarshalAs(UnmanagedType.U2)] public short Day;
[MarshalAs(UnmanagedType.U2)] public short Hour;
[MarshalAs(UnmanagedType.U2)] public short Minute;
[MarshalAs(UnmanagedType.U2)] public short Second;
[MarshalAs(UnmanagedType.U2)] public short Milliseconds;
public SYSTEMTIME(short year, short month, short dayOfWeek, short day, short, hour, short minute, short second, short milliseconds)
{
this.Year = year;
this.Month = month;
this.DayOfWeek = dayOfWeek;
this.Day = day;
this.Hour = hour;
this.Minute = minute;
this.Second = second;
this.Milliseconds = milliseconds;
}
public DateTime ToDateTime()
{
if (Year == 0)
return DateTime.MinValue;
return new DateTime(Year, Month, Day, Hour, Minute, Second, Milliseconds);
}
public static SYSTEMTIME FromDateTime(DateTime dateTime)
{
return new SYSTEMTIME((short)dateTime.Year, (short)dateTime.Month, (short)dateTime.DayOfWeek, (short)dateTime.Day, (short)dateTime.Hour, (short)dateTime.Minute, (short)dateTime.Second, (short)dateTime.Millisecond);
}
}
VB Definition:
<Serializable, StructLayout(LayoutKind.Sequential)>
Public Class SYSTEMTIME
<MarshalAs(UnmanagedType.U2)> Public Year As Short
<MarshalAs(UnmanagedType.U2)> Public Month As Short
<MarshalAs(UnmanagedType.U2)> Public DayOfWeek As Short
<MarshalAs(UnmanagedType.U2)> Public Day As Short
<MarshalAs(UnmanagedType.U2)> Public Hour As Short
<MarshalAs(UnmanagedType.U2)> Public Minute As Short
<MarshalAs(UnmanagedType.U2)> Public Second As Short
<MarshalAs(UnmanagedType.U2)> Public Milliseconds As Short
End Class
Notes:
This can be used when a PInvoke signature requires a "Win32 SYSTEMTIME" otherwise you should be using System.DateTime.
Tips & Tricks:
Please add some!
The mechanism provided by the CLR that enables managed code to call static DLL exports.k
10/27/2022 9:24:28 PM - 114.37.143.20
Please edit this page!
Do you have...
helpful tips?
corrections to the existing content?
alternate definitions?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.