findwindow(api)的具体用法

 

The FindWindow function retrieves a handle to the top-level window whose class name and window name match the

specified strings. This function does not search child windows. This function does not perform a case-sensitive

search.
FindWindow函数根据给定的窗体类名称、窗体名称的字符串搜索父窗体并返回其窗体句柄。这个函数并不搜索子窗体。这个函数并不

完成一个事件感知的搜索。

To search child windows, beginning with a specified child window, use the FindWindowEx function.
要搜索给定窗体的子窗体,使用FindWindowEx函数。

Syntax
语法

HWND FindWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName
);

Parameters
参数

lpClassName
[in] Pointer to a null-terminated string that specifies the class name or a class atom created by a previous call to

the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order

word must be zero.
[输入]一个以零作为终结符的字符串指针,给定窗体的类名称或由先前执行RegisterClass或RegisterClassEx函数创建的类原子,类

原子的低位两个字节必须是lpClassName参数,高位两个字节必须是零。

If lpClassName points to a string, it specifies the window class name. The class name can be any name registered

with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
如果lpClassName指针指向字符串,它就给定了窗体的类名称。类名称可以是RegisterClass或RegisterClassEx注册的任意名称,或

者是任何预先定义好的控件类名称。

If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.
如果lpClassName是空指针,函数将按照lpWindowName参数搜索所有窗体。


lpWindowName
[in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is

NULL, all window names match.
[输入]一个以零作为终结符的字符串指针,给定窗体名称(标题)。如果这个参数是空指针,函数搜索时将忽略窗体名称。


Return Value
函数返回值

If the function succeeds, the return value is a handle to the window that has the specified class name and window

name.
如果函数执行成功,返回值是一个给定的窗体类名称和窗体名称的窗体句柄。

If the function fails, the return value is NULL. To get extended error information, call GetLastError.
如果函数执行失败,返回值为零。执行GetLastError函数获得更多的错误信息。

 

看懂了MSDN就知道了这个函数是查找父窗体句柄的。
比如现在你这个帖子的IE浏览器窗体,它的窗体类名称是"IEFrame",窗体名称就是"百度_vb吧_想问问findwindow(api)的具体用 法! - Microsoft Internet Explorer"。
所以现在这个窗体的句柄就这样来获得:

hwnd=FindWindow("IEFrame","百度_vb吧_想问问findwindow(api)的具体用法! - Microsoft Internet Explorer")

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值