C#导入动态链接库有没有固定的写法

朝三慕四 2010-12-21 07:27:49
如题,用一些Windows API要写那些东东..

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(HandleRef hwnd, out RECT lpRect);

[DllImport("user32.dll")]
public static extern bool GetCursorPos(out System.Drawing.Point lpPoint);

[DllImport("user32.dll")]
public static extern bool PtInRect(ref RECT lprc, System.Drawing.Point pt);


真么个写法,又没有套路..最好据一些例子...谢谢哈...
...全文
36 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
colorall 2010-12-21
  • 打赏
  • 举报
回复
一般就这样就可以
[DllImport("user32.dll")]
public static extern bool PtInRect(ref RECT lprc, System.Drawing.Point pt);

其他都是附加的特定参数

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧