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。
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。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货