2 using System
.Runtime
.InteropServices
;
4 [StructLayout (LayoutKind
.Sequential
)]
5 public class MySystemTime
{
8 public ushort DayOfWeek
;
13 public ushort Milliseconds
;
16 [StructLayout (LayoutKind
.Sequential
)]
22 [StructLayout (LayoutKind
.Explicit
)]
24 [FieldOffset (0)] public int left
;
25 [FieldOffset (4)] public int top
;
26 [FieldOffset (8)] public int right
;
27 [FieldOffset (12)] public int bottom
;
30 [StructLayout (LayoutKind
.Explicit
)]
46 [DllImport ("Kernel32.dll")]
47 public static extern void GetSystemTime (MySystemTime st
);
49 [DllImport ("User32.dll")]
50 public static extern bool PtInRect (ref Rect r
, Point p
);
52 public static int Main () {
54 MySystemTime st
= new MySystemTime ();
58 Console
.WriteLine ("Today's date is : {0:0000}-{1:00}-{2:00}", st
.Year
, st
.Month
, st
.Day
);
59 Console
.WriteLine ("The time now is : {0:00}:{1:00}:{2:00}", st
.Hour
, st
.Minute
, st
.Second
);
68 Point p
= new Point ();
73 if (!PtInRect (ref r
, p
))
89 Console
.WriteLine ("Point lies inside rect");
90 Console
.WriteLine ("Test passes");