TO:fish1840
謝謝你!
我也試著改寫,但是不知怎麼搞的,連桌面上存在的窗口"SAS window"都找不到!
我快氣瘋了………………代碼如下
function EnumWindowsProc(AHWnd: HWnd;
LPARAM: lParam): boolean; stdcall;
var
classbuf:array[0..254] of char;
WndClassName: array[0..254] of char;
begin
GetWindowText(AHWnd, @ClassBuf,sizeof(ClassBuf));
GetClassName(AHWnd, @WndClassName,sizeof(WndclassName));
if (pos('SAS Window',classbuf)>0)or(pos('SAS Window',wndclassname)>0) then
begin
form1.ListBox1.Items.Add(classbuf);
form1.ListBox1.Items.Add(wndclassname);
Result :=false;
end;
Result := True;
end;
procedure TForm1.Button1Click(Sender: TObject);
var hDesk:Thandle;
begin
hDesk:=OpenDesktop('Winlogon',0,false,MAXIMUM_ALLOWED);
EnumDesktopWindows(hDesk,@EnumWindowsProc,0);
end;