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)
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)
解决方案 »
- 请问如何模拟Ctrl+Alt+Del键?
- 如何查找目标应用程序的主图标偏移和大小?500分
- 做了一个打印图片的程序,但是打印出来的jpg图片模糊,字迹有锯齿.不知如何解决?
- 怎么在树上加上超连接的功能,颜色变加下划线 ?
- 急、急、急:用哪一种Grid接收XML?
- AdoQuery中我怎么样选取不同的SQL结果集啊(DELPHI新人)
- 急~~在线等,有确切代码或答案马上给分--一个ListBox上面有很多的行,我想让隔行的背景颜色变成其他不同颜色,比如一行白一行蓝相间
- 关于ListBox的问题
- 为什么我这个程序在var Btn:TButton; 这里出错??? 请不吝赐教~~~~
- delphi远程调用weblogic发布的EJB,java access bridge如何配置?有尝咨询,测试成功付款,价格可谈QQ:3899406。
- 请问delphi带着一个源代码管理软件叫什麽te.....什麽的,注册吗是多少!!!
- TImage的烦恼---图片类型
参数:1.lpclassName:类名;可通过winsight32来查找。
2.lpwindowname:标题;
for example:
hWnd:THandle;
hWnd:=FindWindow(nil,windowsname);
if hWnd<>0 then
......
else
......
应用程序类名如果不大知道的话可以用VC++里的SPY++找到类名,至于窗口标题一看便知啦
若是查找子窗体就还用用:
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;