锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91一区二区三区四区,日本韩国精品一区二区在线观看,一区二区蜜桃http://www.aygfsteel.com/Titan/articles/30299.htmlTitanTitanSat, 11 Feb 2006 14:22:00 GMThttp://www.aygfsteel.com/Titan/articles/30299.htmlhttp://www.aygfsteel.com/Titan/comments/30299.htmlhttp://www.aygfsteel.com/Titan/articles/30299.html#Feedback0http://www.aygfsteel.com/Titan/comments/commentRss/30299.htmlhttp://www.aygfsteel.com/Titan/services/trackbacks/30299.html浣跨敤C#鏃朵笉鍏嶇敤璋冪敤鍒殑DLL錛屽WIN32鐨凙PI鍜岃嚜宸變互鍓嶅仛鐨凞LL錛?
C#璋冪敤DLL寰堝儚VB錛屼笅闈㈣璁虹殑C#璋冪敤DLL鐨勬柟寮忋?
鐪嬬湅涓嬮潰鐨勪緥瀛愶紝婕旂ず浜嗘庝箞瀹氫箟DLL鍑芥暟鎺ュ彛
public class Utility
{
   [DllImport("kernel32",
EntryPoint=鈥滳reateDirectory鈥?
CallingConvention=CallingConvention.StdCall]
   public static extern bool Create (string name);
  
   [DllImport("User32"]
EntryPoint=鈥滿essageBox鈥?
CallingConvention=CallingConvention.StdCall]
   public static extern int MsgBox (string msg);
}
  
class MyClass
{
   public static int Main()
   {
      string myString;
      Console.Write("Enter your message: ");
      myString = Console.ReadLine();
      return Utility.MsgBox(myString);
   }
}
  
鍊煎緱娉ㄦ剰鐨勬槸錛岀己鐪佺殑璋冪敤瑙勫垯(CallingConvention)鏄疭tdcall錛屽悓Winapi錛屽湪
C++閲屾槸__stdcall鐨勫艦寮忥紝鍑芥暟鍏ュ彛(EntryPoint)緙虹渷鏄悓鍚嶏紝濡侰reateDirectory
鐨勫畾涔変篃鍙互涓?
   [DllImport("kernel32")]
   static extern bool CreateDirectory(string name, SecurityAttributes sa);
  
WIN32 API鍘熷瀷涓?
BOOL CreateDirectory(
  LPCTSTR lpPathName,                         // directory name
  LPSECURITY_ATTRIBUTES lpSecurityAttributes  // SD
);
  
鍦ㄨ皟鐢╓IN32 API鏃舵敞鎰忛偅浜涚被鍨嬬殑杞崲錛屽緇撴瀯(struct)銆佹寚閽?pointer)錛?

鏈夊叧鍚勭璇█涔嬮棿綾誨瀷杞崲鍜孌llImport灞炴х殑璇︾粏淇℃伅鍙互鍙傝僑DK鏂囨。 

Titan 2006-02-11 22:22 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 黄平县| 望谟县| 兰溪市| 乐业县| 奉贤区| 娄底市| 肃宁县| 万载县| 惠安县| 雅安市| 德昌县| 黑水县| 得荣县| 绥德县| 岐山县| 岳阳县| 涪陵区| 平舆县| 浦江县| 徐水县| 台中县| 宝鸡市| 温州市| 温泉县| 甘肃省| 修水县| 陈巴尔虎旗| 虎林市| 新野县| 社会| 旌德县| 阳东县| 家居| 南安市| 甘洛县| 泾阳县| 临潭县| 文成县| 长泰县| 青田县| 青冈县|