掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
EnumChildWindowsでTLabelを取得するには? (ID:45401)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
一応、力技でコード変換してみました。 Delphi2009以降では動かない(コンパイルできない)と思いますが(^_^;) function TForm1.ExtractLabelParam(st: TStream): string; var s: string; sLine: TStringList; LabelFlag: boolean; function CodeToString(const Str: string): string; var ix: integer; c: char; cnt: integer; buf: string; wc: WideChar; begin Result := ''; ix := 1; while Length(Str) >= ix do begin c := Str[ix]; if c <> '''' then begin if c = '#' then begin cnt := 0; buf := ''; Inc(ix); c := Str[ix]; while c in ['0'..'9'] do begin buf := buf + c; Inc(cnt); Inc(ix); c := Str[ix]; end; Dec(ix); if cnt = 5 then begin wc := WideChar(StrToInt(buf)); Result := Result + wc; end else Result := Result + '#' + buf; end else Result := Result + c; end; Inc(ix); end; end; begin Result := ''; LabelFlag := False; sLine := TStringList.Create; try st.Position := 0; sLine.LoadFromStream(st); for s in sLine do begin if (Pos('object', s) > 0) and (Pos(': TLabel', s) > 0) then begin Result := Result + 'Name : '+Copy(s, Pos('object', s)+7, Pos(': TLabel', s)-(Pos('object', s)+7)) + #13; LabelFlag := True; end; if LabelFlag then begin if Pos('Caption =', s) > 0 then Result := Result + ' Caption = ''' + CodeToString(Copy(s, Pos('Caption =', s)+10, Length(s))) + ''''#13; if Pos(' Hint =', s) > 0 then Result := Result + ' Hint = ''' + CodeToString(Copy(s, Pos('Hint =', s)+7, Length(s))) + ''''#13; if Trim(s) = 'end' then begin Result := Result + #13; LabelFlag := False; end; end; end; finally sLine.Free; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.