获取打开的记事本中的内容
--------------------------------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
h: HWND;
p: Pointer;
Len: Integer;
begin
h := FindWindow('Notepad', nil);
if h = 0 then Exit;
h := GetWindow(h, GW_CHILD);
if h = 0 then Exit;
Len := SendMessage(h, WM_GETTEXTLENGTH, 0, 0) + 1;
p := GlobalAllocPtr(0, Len * SizeOf(Char));
SendMessage(h, WM_GETTEXT, Len, Cardinal(p));
ShowMessage(PChar(p));
GlobalFreePtr(p);
end;