首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

请问关于字符串比较的有关问题

2013-08-14 
请教关于字符串比较的问题诚心请教各位大侠,有段程序,需要对返回的类名做判断,但一直不通过,请问该怎么修

请教关于字符串比较的问题
诚心请教各位大侠,有段程序,需要对返回的类名做判断,但一直不通过,请问该怎么修改?非常感谢!


 function EnumChildWndProc(AhWnd:LongInt;
AlParam:lParam):boolean;stdcall;
    var
WndClassName:string;
WndCaption:string;
ClasName:string;
begin
SetLength(WndClassName,256);
GetClassName(AhWnd,PChar(WndClassName), Length(WndClassName));
WndClassName := StrPas(PChar(WndClassName));

SetLength(WndCaption, 256);
GetWindowText(AhWnd, PChar(WndCaption), Length(WndCaption));
WndCaption := StrPas(PChar(WndCaption));

SetLength(ClasName,256);
ClasName:='combobox';
If CompareStr(ClasName,WndClassName)=0 then //这里是要使用compareStr函数对得到类名做判断,该怎么修改呢?                                        
Begin
.....
end;
result:=true;
end;
end;


[解决办法]
function EnumChildWndProc(AhWnd: LongInt; AlParam: lParam): Boolean; stdcall;
var
  WndCaption, WndClassName: array[0..254] of Char;
  ClasName: string;
begin
  Result := True;
  GetClassName(AWnd, @WndClassName, 254);
  GetWindowText(AWnd, @WndCaption, 254);
  ClasName := ;
  if WndClassName = 'combobox' then
  begin
    .....
  end;
end;

热点排行