乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      extern \調(diào)用系統(tǒng)API

       秋水風(fēng)帆 2010-11-18
      using System;
                  using System.Runtime.InteropServices;
                  class MainClass
                  {
                  [DllImport("User32.dll")]
                  public static extern int MessageBox(int h, string m, string c, int type);
                  static int Main()
                  {
                  string myString;
                  Console.Write("Enter your message: ");
                  myString = Console.ReadLine();
                  return MessageBox(0, myString, "My Message Box", 0);
                  }
                  }

      Collapse 圖像示例 3

      說明

      該示例使用兩個文件 CM.csCmdll.c 來說明 extern。C 文件是示例 2 中創(chuàng)建的外部 DLL,它從 C# 程序內(nèi)調(diào)用。

      代碼

        CopyCode image復(fù)制代碼
      // cm.cs
                  using System;
                  using System.Runtime.InteropServices;
                  public class MainClass
                  {
                  [DllImport("Cmdll.dll")]
                  public static extern int SampleMethod(int x);
                  static void Main()
                  {
                  Console.WriteLine("SampleMethod() returns {0}.",
                  SampleMethod(5));
                  }
                  }

      Collapse 圖像輸出

       
      SampleMethod() returns 50.

      Collapse 圖像備注

      生成項目:

      • 使用 Visual C++ 命令行將 Cmdll.c 編譯為 DLL:

        cl /LD /MD Cmdll.c

      • 使用命令行編譯 CM.cs

        csc CM.cs

      這將創(chuàng)建可執(zhí)行文件 CM.exe。運行此程序時,SampleMethod 將值 5 傳遞到 DLL 文件,該文件將此值乘以 10 返回。

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多