Ver Mensaje Individual
  #13  
Antiguo 02-03-2020
Avatar de escafandra
[escafandra] escafandra is offline
Miembro Premium
 
Registrado: nov 2007
Posts: 2.197
Reputación: 20
escafandra Tiene un aura espectacularescafandra Tiene un aura espectacular
Ok. Te presento un programita que se ejecuta maximizado mostrando un Label que dice "LOADING GAME" al arrancar. Luego Ejecuta "Notepad.exe" y se esconde. Al cerrar Notepad, el programita se termina.


Espero que esta sea la idea de lo que quieres hacer.


Código Delphi [-]
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    function Execute(CommandLine: String): cardinal;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

//------------------------------------------------------------------------------
// Creamos un proceso.
function TForm1.Execute(CommandLine: String): cardinal;
var
  SI: TStartupInfo;
  PI: TProcessInformation;
begin
  ZeroMemory(@SI, sizeof(TStartupInfo));
  SI.cb:= sizeof(SI);
  SI.dwFlags:= STARTF_USESHOWWINDOW or STARTF_USEPOSITION or STARTF_USESIZE;
  SI.wShowWindow:= SW_SHOW;
  Result:= 0;
  if CreateProcess(nil, PCHAR(CommandLine), nil, nil, false, 0, nil, nil, SI, PI) then
  begin
    WaitForInputIdle(PI.hProcess, 10000);
    Visible:= false;
    WaitForSingleObject(PI.hProcess,INFINITE);
    GetExitCodeProcess(PI.hProcess, Result);
    CloseHandle(PI.hProcess);
    CloseHandle(PI.hThread);
  end
  else
    Result:= $FFFFFFFF;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  WindowState:= wsMaximized;
  FormStyle:= fsStayOnTop;
  BorderStyle:= bsNone;
  Label1.Caption:= '"LOADING GAME"';
  Label1.Font.Size:= 30;
  Label1.Font.Style:= [fsBold];


  // Simula que tarda en cargar...
  Timer1.Interval:= 2000;  // Poner Timer1.Interval:= 1 para no esperar nada,
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  // Simula que tarda en cargar...
  Execute('Notepad.exe');

  Visible:= True;
  Label1.Caption:= 'NOS VAMOS';
  Update;
  Sleep(500);
  Close;
end;

end.


Saludos.
Responder Con Cita