unit icq;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ShellAPI, ComCtrls, RichEdit;
type
LPGETTEXTEX = ^GETTEXTEX;
GETTEXTEX =
record
cb: DWORD;
flags: DWORD;
codepage: UINT;
lpDefaultChar: LPCSTR;
lpUsedDefaultChar: PBOOL;
end;
TForm1 =
class(TForm)
Button1: TButton;
RichEdit1: TRichEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
tex: GETTEXTEX;
pc: PChar;
wnd: HWND;
implementation
{$R *.dfm}
function FindWindowEx2(hParent: HWND; ChildClassName:
string; ChildNr: Word): HWND;
var
i: Word;
hChild: HWND;
begin
hChild := 0;
Result := 0;
ChildNr := ChildNr - 1;
for i := 0
to ChildNr
do
begin
hChild := FindWindowEx(hParent, hChild, PChar(ChildClassName),
nil);
if hChild = 0
then
Exit;
Result := hChild;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
wnd: HWND;
begin
tex.cb := SizeOf(pc);
tex.flags := GT_USECRLF;
tex.codepage := CP_ACP;
tex.lpDefaultChar :=
nil;
tex.lpUsedDefaultChar :=
nil;
wnd := FindWindow('
WordPadClass','
Dokument - WordPad');
wnd := FindWindowEx(wnd, 0, '
RICHEDIT50W',
nil);
SendMessage(wnd, EM_GETTEXTEX, WPARAM(@tex), LPARAM(@pc[0]));
if pc = '
'
then begin
ShowMessage('
NIX AUSGELESEN!');
end
else begin
RichEdit1.Text := pc;
end;
end;
end.