- 29
- 0
- 约1.95万字
- 约 33页
- 2021-01-07 发布于天津
- 举报
C#写个类操作窗口(句柄操作)
实现过程:
过程一:找到当前鼠标位置的句柄
您的使用2个WinAPI (俺喜欢自己封装下来用):
TDview Code
[Dlllmport( public
user32.dll static exter n
,En tryPo int =bool GetCursorPos(
GetCursorPosout Point pt);
)]
[DllImport( public
user32.dll static exter n
,En tryPoi nt = Win dowFromPoi nt
In tPtr Win dowFromPoi nt(Poi nt pt);
)]
//鼠标位置的坐标
public static Poi nt GetCursorPosPoi nt()
{
Point p = new Poi nt();
if (GetCursorPos( out p))
{
return p;
}
return default (Poi nt);
}
/// summary
/// 找到句柄
/// /summary
/// vparam n ame=p 坐标 /param
/// vretur nsx/retur ns
public static In tPtr GetHa ndle(Poi nt p)
{
return Win dowF
原创力文档

文档评论(0)