会员
周边
捐助
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
alex hu
你若盛开,清风自来!
博客园
首页
新随笔
联系
订阅
管理
C# api 得到机器名
Code
[DllImport(
"
kernel32.dll
"
,
EntryPoint
=
"
GetComputerName
"
,
ExactSpelling
=
false
,
SetLastError
=
true
)]
static
extern
bool
GetComputerName(
[MarshalAs(UnmanagedType.LPArray)]
byte
[] lpBuffer,
[MarshalAs(UnmanagedType.LPArray)] Int32[] nSize);
public
Form1()
{
InitializeComponent();
byte
[] str
=
new
byte
[
20
];
Int32[] len
=
new
Int32[
1
];
len[
0
]
=
20
;
GetComputerName(str, len);
MessageBox.Show(System.Text.Encoding.ASCII.GetString(str));
}
posted @
2008-12-23 15:52
alex hu
阅读(
468
) 评论(
1
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告