紫水晶编程技术论坛 - 努力打造成全国最好的编程论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 3726|回复: 1

[开源] 【C#】C#调用API 及使用例子

[复制链接]

1214

主题

1566

帖子

11

精华

管理员

菜鸟

Rank: 125Rank: 125Rank: 125Rank: 125Rank: 125

积分
93743

贡献奖关注奖人气王精英奖乐于助人勋章

发表于 2016-10-19 06:32:47 | 显示全部楼层 |阅读模式
  1. using System.Text;
  2. using System.Runtime.InteropServices;
  3. public class api
  4. {
  5.     [DllImport("user32.dll", EntryPoint = "MessageBox")]
  6.     public static extern int MsgBox(int hWnd, String text, String caption, uint type);

  7.     [DllImport("kernel32.dll")]
  8.     public static extern int GetShortPathName(string path, StringBuilder shortPath, int shortPathLength);
  9. }

  10. 调用:api.MsgBox(0, "a", "b", 64);
复制代码
【VB】QQ群:1422505加的请打上VB好友
【易语言】QQ群:9531809  或 177048
【FOXPRO】QQ群:6580324  或 33659603
【C/C++/VC】QQ群:3777552
【NiceBasic】QQ群:3703755

854

主题

3481

帖子

2

精华

管理员

此生无悔入华夏,  长居日耳曼尼亚。  

Rank: 125Rank: 125Rank: 125Rank: 125Rank: 125

积分
36100
发表于 2016-11-12 09:11:24 | 显示全部楼层
有点像VB.NET
您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

手机版|Archiver|紫水晶工作室 ( 粤ICP备05020336号 )

GMT+8, 2024-4-20 19:33 , Processed in 0.021643 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表