Ver Mensaje Individual
  #2  
Antiguo 28-07-2006
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
El problema es una cosa sencillita, pero ya puestos, he retocado un poco el código espero que no te moleste

Código Delphi [-]
var
  hText: THandle;
  pText: PChar;
  F: TextFile;
begin
  if IsClipboardFormatAvailable(CF_TEXT) then
    if OpenClipboard(0) then
    try
      hText:= GetClipboardData(CF_TEXT);
      if hText <> 0 then
      begin
        pText:= GlobalLock(hText);
        if pText <> nil then
        begin
          AssignFile(F, ParamStr(0)+'.txt');
          {$I-}
            Rewrite(F);
          {$I+}
          if IOResult=0 then
          begin
            // Aqui estaba el error, para que lo convierta en string primero hay que indicarle que es un PChar
            WriteLn(F, String(PChar(pText)));
            CloseFile(F);
          end;
          GlobalUnlock(hText);
        end;
      end;
    finally
      CloseClipboard;
    end;
end;
Responder Con Cita