|
unit main;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
IdURI,IniFiles,Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
|
|
|
|
type
|
|
|
|
{ TfrmMain }
|
|
|
|
TfrmMain = class(TForm)
|
|
procedure FormCreate(Sender: TObject);
|
|
private
|
|
procedure Cargarpantalla();
|
|
function LeerIni(): boolean;
|
|
|
|
{ private declarations }
|
|
public
|
|
{ public declarations }
|
|
end;
|
|
|
|
var
|
|
frmMain: TfrmMain;
|
|
|
|
implementation
|
|
uses global, mensaje,icono;
|
|
{ TfrmMain }
|
|
Function Tfrmmain.LeerIni():boolean;
|
|
var
|
|
Mifichero:TMemIniFile;
|
|
stipo:string;
|
|
stiempo:string;
|
|
sarchivo:string;
|
|
begin
|
|
result:=false;
|
|
if FileExists(g_dirmensaje) then
|
|
begin
|
|
Mifichero:= TMemIniFile.create(g_dirmensaje);
|
|
with MiFichero do
|
|
begin
|
|
stipo:=ReadString('MENSAJE','tipo','');
|
|
if trim(stipo)='' then stipo:='0';
|
|
g_tipo:=strtoint(stipo);
|
|
g_mensaje:=ReadString('MENSAJE','mensaje','');
|
|
g_mensaje:=TidURI.URLDecode(g_mensaje);
|
|
g_titulo:=ReadString('MENSAJE','titulo','');
|
|
g_titulo:=TidURI.URLDecode(g_titulo);
|
|
g_usuario:=ReadString('MENSAJE','usuario','');
|
|
stiempo:=ReadString('MENSAJE','tiempo','');
|
|
if trim(stiempo)='' then stiempo:='9000';
|
|
g_tiempo:=strtoint(stiempo);
|
|
sarchivo:=ReadString('MENSAJE','archivo','');
|
|
if trim(sarchivo)='' then sarchivo:='0';
|
|
g_archivo:=strtoint(sarchivo);
|
|
Free;
|
|
result:=true;
|
|
end;
|
|
end
|
|
end;
|
|
|
|
procedure Tfrmmain.Cargarpantalla();
|
|
begin
|
|
case g_tipo of
|
|
0:
|
|
begin
|
|
application.CreateForm(Tfrmicono,frmicono);
|
|
frmicono.ShowModal;
|
|
end;
|
|
else
|
|
begin
|
|
application.CreateForm(TfrmMensajes,frmmensajes);
|
|
frmMensajes.ShowModal;
|
|
end;
|
|
end;
|
|
application.Terminate;
|
|
end;
|
|
procedure TfrmMain.FormCreate(Sender: TObject);
|
|
begin
|
|
|
|
if LeerIni() then
|
|
CargarPantalla()
|
|
else
|
|
application.Terminate;
|
|
end;
|
|
|
|
initialization
|
|
{$I main.lrs}
|
|
|
|
end.
|
|
|