function EnumWindowsProc(Handle: HWND; List: TStrings):boolean;stdcall;
var
  WinStyles : DWord;
  WinText:Array[0..100] of Char;
  WinClsName:Array[0..100] of Char;
  strTmp:string;
  aIcon:HICON;
  AI:TWinInfo;
begin
  Result := true;
  WinStyles := GetWindowLong(Handle, GWL_STYLE);
  If ((WinStyles and WS_VISIBLE) > 0) then 
  begin
  GetClassName(Handle,WinClsName,100);
  GetWindowText(Handle,WinText,100);
  strTmp := WinText;
  If Trim(strTmp)<>'' then
  begin
    AI := TWinInfo.Create;
    AI.FIcon := GetClassLong(Handle,GCL_HICON);
    AI.FCaption := strTmp;
    AI.FClsName := WinClsName;
    AI.FHandle := Handle;
    List.AddObject(IntToStr(Handle),AI);
  end;
  end;
end;
procedure GetAllWindow(List:TStrings);stdcall;
begin
  EnumWindows(@EnumWindowsProc,integer(List));
end;
end.
运行到红色那一句时出现“raised exception class ERangeError with message 'Range check error',请问问题出在哪里?我的系统是XP,用的delphi7。