Ver Mensaje Individual
  #1  
Antiguo 31-07-2023
sEngine sEngine is offline
Miembro
 
Registrado: jul 2021
Posts: 53
Reputación: 3
sEngine Va por buen camino
Error al abrir app por segunda vez

Buenos días, a ver si me podeis ayudar. Estoy teniendo un problema con delphi desde hace unas semanas. Por alguna razón me genera mal el ejecutable y a la segunda vez que inicio mi app, recibo este error.






Se que el problema no es del código de la app porque he probado a utilizar código antiguo que iba bien, y en cuanto genero el exe vuelve a ocurrirme. La única forma que he conseguido para que no salga el error es poner un showmessage justo antes de que de el mensaje.
Cada vez que genero el exe, funciona bien la primera vez, las siguientes ya no, hasta que reinicio el equipo.
¿Alguna idea?


El codigo inicial (del dpr) es este

Código Delphi [-]
var
  IniAux: TIniFile;
  Mutex : THandle;
begin
  Mutex := CreateMutex(nil, True, 'GemaExclusiveMutex');
  if (Mutex <> 0) And (Windows.GetLastError =  0) then
    begin
      try
        with Application do
        begin
          if (ShortDateFormat = 'M/d/yyyy') then
          begin
            ShortDateFormat:='MM/dd/yyyy';
          end;
    //      showMessage('');        <--- si pongo el showmessage aqui es cuando funciona
          CreateForm(TDMFJoya, DMFJoya);
          CreateForm(TDM, DM);
          CreateForm(TFMain, FMain);
          if FMain.bErrorGrave then Exit;
          FMain.Visible := False;
          FMain.Show;
          if not FMain.bModoAutomatico then
          begin
            FMain.WmAfterCreate;
          end;
          Run;
        end;
      finally
        if Mutex <> 0 then
        begin
          DMFJoya.Free();
          CloseHandle(Mutex);
        end;
         IniAux.Free;
      end;
    end
  else
     ShowMessage('La aplicación ya está en ejecución');
Responder Con Cita