Windows API

 

百度百科:Windows API

 

C#中调用Windows API:

using System.Runtime.InteropServices; //引用此名称空间,简化后面的代码

//使用DllImportAttribute特性来引入api函数,注意声明的是空方法,即方法体为空。
[DllImport("user32.dll")]
public static extern ReturnType FunctionName(type
arg1,type arg2,...);
//调用时与调用其他方法并无区别
可以使用字段进一步说明特性,用逗号隔开,如:
[ DllImport( "kernel32",EntryPoint="GetVersionEx" )]

posted on 2017-11-24 15:45  荆棘人  阅读(152)  评论(0编辑  收藏  举报

导航