示例#1
0
        public static void SayHello()
        {
            string s = "おはよう";

            Console.WriteLine(s);
            DoSomething();
            DoSomething2("我也很无奈啊");

            //var c= DoSomething3("这段数据来自c#");
            //Console.WriteLine(c);
            int ws = 90;

            ws += 7;
            DoSomething4((f) => Console.WriteLine("C# Print c++ data :" + f));
            Console.WriteLine("Main treard start ---");

            Main m = new Main();


            Thread t = new Thread(m.PrintNanme);

            t.Start(" wang wu");

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("main Tread num :  " + i);
                Thread.Sleep(100);
            }
            Console.WriteLine("Main thread: Call Join(), to wait until ThreadProc ends.");
            t.Join();
            Console.WriteLine("Main thread: ThreadProc.Join has returned. ");

            MySystemTime sysTime = new MySystemTime();

            NativeMethods.GetSystemTime(sysTime);

            string dt;

            dt = "System time is: \n" +
                 "Year: " + sysTime.wYear + "\n" +
                 "Month: " + sysTime.wMonth + "\n" +
                 "DayOfWeek: " + sysTime.wDayOfWeek + "\n" +
                 "Day: " + sysTime.wDay;
            NativeMethods.MessageBox(IntPtr.Zero, dt, "Platform Invoke Sample", 0);

            Point p = new Point();

            p.x = 1;
            p.y = 2;
            p.z = 3;

            //  p.intValue = new IntValue(666);

            DoWithClass(p);
        }
示例#2
0
 internal static extern void GetSystemTime(MySystemTime st);