关于API函数:findwindow应该怎么用?

phenixyu 2000-12-11 12:44:00
究竟第一个参数应如何设置。
...全文
273 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
phenixyu 2000-12-12
  • 打赏
  • 举报
回复
那找子窗口呢?
alwssoan 2000-12-12
  • 打赏
  • 举报
回复
FindWindow(应用程序类名,窗口标题);
应用程序类名如果不大知道的话可以用VC++里的SPY++找到类名,至于窗口标题一看便知啦
lixiaolei 2000-12-12
  • 打赏
  • 举报
回复

若是查找子窗体就还用用:
FindWindowEx( Parent: HWND; {a handle to a parent window}
Child: HWND; {a handle to a child window}
ClassName: PChar; {a pointer to a null terminated class name string}
WindowName: PChar {a pointer to a null terminated window name string}
): HWND;
procedure TForm1.Button1Click(Sender: TObject);
var
AHwnd: HWND;
WindowText: array[0..255] of char;
begin
AHwnd:= FindWindow('AClass',nil);
{ find a TEdit child window }
AHwnd:=FindWindowEx(AHwnd, 0, 'TEdit',nil);
GetWindowText(AHwnd, WindowText, 255);
Label1.Caption:=WindowText;
end;

xnake 2000-12-11
  • 打赏
  • 举报
回复
nil
ePing 2000-12-11
  • 打赏
  • 举报
回复
Syntax
FindWindow(
lpClassName: PChar; {a pointer to a null terminated class name string}
lpWindowName: PChar {a pointer to a null terminated window name string}
): HWND; {returns a handle to a window}
example:
//the window explorer program must be running in a non-minimized state before
//this example will work
procedure TForm1.Button1Click(Sender: TObject);
var
TheWindow: HWND;
begin
//find a handle to the Windows Explorer window
Thewindow := FindWindow('ExplorerWClass',nil);
//bring it to the top
BringWindowToTop(TheWindow);
end;

三少 :o)
nisky 2000-12-11
  • 打赏
  • 举报
回复
该函数可对窗口类进行查找,如成功则返回窗口句柄。
参数:1.lpclassName:类名;可通过winsight32来查找。
2.lpwindowname:标题;
for example:
hWnd:THandle;
hWnd:=FindWindow(nil,windowsname);
if hWnd<>0 then
......
else
......
zheng 2000-12-11
  • 打赏
  • 举报
回复
关注

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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