AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi [nonVCL] Textlänge & GetWindowText, ExtTextOut Problem

[nonVCL] Textlänge & GetWindowText, ExtTextOut Problem

Ein Thema von turboPASCAL · begonnen am 16. Mär 2006 · letzter Beitrag vom 16. Mär 2006
 
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#3

Re: [nonVCL] Textlänge & GetWindowText, ExtTextOut Probl

  Alt 16. Mär 2006, 08:37
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  Buffer : PChar;
  len : Integer;
begin
  len := GetWindowTextLength(Handle);
  if len > 0 then
  begin
    try
      GetMem(Buffer, len);
      GetWindowText(Handle, Buffer, len);
      TextOut(Canvas.Handle, 10, 10, Buffer, len);
    finally
      FreeMem(Buffer);
    end;
  end
  else
    ShowMessage(SysErrorMessage(GetLastError));
end;
Aber beachte:
Zitat:
GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.
Und:
Zitat:
Under certain conditions, the GetWindowTextLength function may return a value that is larger than the actual length of the text. [..] It can also occur when an application uses the ANSI version of GetWindowTextLength with a window whose window procedure is Unicode, or the Unicode version of GetWindowTextLength with a window whose window procedure is ANSI.
Zitat:
To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.
Und zu GetWindowText:
Zitat:
This function cannot retrieve the text of an edit control in another application.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:08 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz