TEdit.GetLine [Windows]

procedure TWin.Save;
var
  s : string;
  i : word;
begin
  filename := 'test.bas';

  assign(f, filename);
  rewrite(f);

  getmem(temp, 65535);
  for i := 1 to editor^.GetNumLines do
  if not editor^.GetLine(temp, editor^.GetLineLength(i), i) then
  messagebox(0, temp, 'Grrrrr', mb_ok);

  freemem(temp, 65535);
end;

Why does the above code not work properly? (the messagebox pops up,
unfortunately).
I don't think it's a memory allocation problem.

temp: global PChar
f: file of PChar.
Editor: ^TEdit.