findwindow的问题

来源:百度知道 编辑:UC知道 时间:2024/05/26 04:23:58
procedure TForm1.Button1Click(Sender: TObject);
var
Hwd:THandle;
begin
repeat
Hwd :=0;
Hwd :=FindWindow(nil,'计算器');
if Hwd >0 then
ListBox1.Items.Add(IntToStr(Hwd));
until Hwd =0 ;
end;

上段代码可以遍历出用户开的计算器的所有窗口句柄,可是hwd:=0这一句好像没用,,不知道是什么问题,有人能说一下么,
T_T发错版块了,

Return Values
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.

你应用:if Hwn != NULL then '........

你应用:if Hwn != NULL then '........