我用Delphi5 + WindowsXP Professional,遇到了麻烦 procedure TForm1.btnRefreshClick(Sender: TObject); 
var 
hCurrentWindow: HWnd; 
szText: array[0..254] of char; 
ListItem:TListItem; 
begin 
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST); 
while hCurrentWindow <> 0 do 
begin 
if GetWindowText(hCurrentWindow, @szText, 255)>0 then 
ListItem:=listview1.Items.Add; 
ListItem.caption:=intToStr(hCurrentWindow); 
ListItem.subitems.add (StrPas(@szText)); 
GetClassName(hCurrentWindow, @szText, 255); 
ListItem.subitems.add (StrPas(@szText)); 
ListItem.subitems.add ('否'); 
ListItem.subitems.add ('无'); 
hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT); 
end; 
end; end. 
以上代码产生如下错误提示,请问如何解决,谢谢~~! 
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004432DF in module 'project1.exe'. Read of address 000006D8'. Process stopped. Use Step or Run to continue.