会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
geoff
输入您的搜索字词
提交搜索表单
博客园
首页
新随笔
联系
订阅
管理
声明 findwindow 函数
[DllImport(
"
user32.dll
"
)]
private
static
extern
IntPtr FindWindow(
string
lpClassName,
string
lpWindowName);
这里再声明一下FindWindowEx 函数。
//
Open Up blank Notepad First !
string
lpszParentClass
=
"
Notepad
"
;
string
lpszParentWindow
=
"
Untitled - Notepad
"
;
string
lpszClass
=
"
Edit
"
;
IntPtr ParenthWnd
=
new
IntPtr(
0
);
IntPtr hWnd
=
new
IntPtr(
0
);
ParenthWnd
=
FindWindow(lpszParentClass,lpszParentWindow);
if
(ParenthWnd.Equals(IntPtr.Zero))
Console.WriteLine(
"
Notepad Not Running
"
);
else
{
hWnd
=
FindWindowEx(ParenthWnd,hWnd,lpszClass,
""
);
if
(hWnd.Equals(IntPtr.Zero))
Console.WriteLine(
"
What the F??? Notepad doesn't have an edit component ?
"
);
else
{
Console.WriteLine(
"
Notepad Window:
"
+
ParenthWnd.ToString());
Console.WriteLine(
"
Edit Control:
"
+
hWnd.ToString());
}
}
posted @
2006-11-05 12:50
梁小鱼
阅读(
621
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告