Ver Mensaje Individual
  #4  
Antiguo 12-03-2009
Avatar de gulder
gulder gulder is offline
Miembro
 
Registrado: abr 2005
Ubicación: colombia-sucre
Posts: 384
Reputación: 20
gulder Va por buen camino
Thumbs up

Hola
Gracias a dec y Young solocionada con el siguiente codigo lo dejo de muestra saludes



Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,IniFiles;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

  dir:string;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
dir := ExtractFilePath(ParamStr(0));

 iniFile := TIniFile.Create(dir+'p.ini');
  if  FileExists(dir+'p.ini') then begin

       form1.Height:= iniFile.ReadInteger('Interfaz', 'Heith_alto',0);
       form1.Width:= iniFile.ReadInteger('Interfaz', 'Whith_ancho',0);
       form1.Left:= iniFile.ReadInteger('Interfaz', 'Left_x',0);
       form1.Top:= iniFile.ReadInteger('Interfaz', 'Top_y',0);

  end else begin


  iniFile.WriteInteger('Interfaz', 'Heith_alto',580);
  iniFile.WriteInteger('Interfaz', 'Whith_ancho',800);
  iniFile.WriteInteger('Interfaz', 'Left_x',140);
  iniFile.WriteInteger('Interfaz', 'Top_y',80);

  end;

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin

  iniFile := TIniFile.Create(dir+'p.ini');
  iniFile.WriteInteger('Interfaz', 'Heith_alto',form1.Height);
  iniFile.WriteInteger('Interfaz', 'Whith_ancho',form1.Width);
  iniFile.WriteInteger('Interfaz', 'Left_x',form1.Left);
  iniFile.WriteInteger('Interfaz', 'Top_y',form1.Top);


end;

end.
Responder Con Cita