C#积木模块ABC:8.如何调用Windows API?

添加人:gamefriends二级(651分)   添加时间:2007-09-14    阅读次数:783  收藏此教程
8.如何调用Windows API?

 

在C#中调用一个API同在VB中调用API一样。我们应该知道API的DLL名称,并且使用sysimport引入它。下面这个例子显示了如何调用MessageBox API:


using System;


class callAPICls {


[sysimport(dll="user32.dll")]


public static extern int MessageBoxA(int h, string m, string c, int type);


public static int Main()


{


return MessageBoxA(0, "Hello World!", "Caption", 0);


}


}


1页 第1上一页1下一页
相关的教程: CSharp 入门
收藏此教程

当前平均分: -5.0(1 次打分)

-5-4-3-2-1012345
评论主题
您的大名
您的评论
验证码 点击换一个验证码
知识库搜索: