Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > API de Windows
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 14-06-2007
nosferatu177 nosferatu177 is offline
Miembro
 
Registrado: mar 2007
Posts: 42
Poder: 0
nosferatu177 Va por buen camino
terminar aplicacion

hola cHackAll , en este caso estoy desarrollando un instalador, asi mismo desarrolle tambien los archivos.exe q mando ejecutar; este es parte del codigo q utilice e implemente de acuerdo al codigo q encontre en la liga antes mencionada(sigo en el entendido q este me ayuda a mandar ejecutar un .exe y cuando termine de ejecutarse pueda continuar con el instalador algo asi como poder tener el control de ese proceso):

Código Delphi [-]

    if creabd.Checked=true then
    begin
//***se crea el proceso para esperar a q se termine de ejecutar esta aplicación***//
      FillChar(proc_info, sizeof(TProcessInformation), 0);
      FillChar(startinfo, sizeof(TStartupInfo), 0);
      startinfo.cb := sizeof(TStartupInfo);
      if CreateProcess(nil, PChar(FInstalacion.dircd.Text+'\mysql_odbc\CreaBase.exe '+base+' root sqlpr65'), nil, nil, false, CREATE_DEFAULT_ERROR_MODE + NORMAL_PRIORITY_CLASS, nil, nil, startinfo, proc_info) then
        Timer1.Enabled := True
      else
      begin
        CloseHandle(proc_info.hProcess);
        Application.MessageBox('No se pudo ejecutar la aplicación', 'Error', MB_ICONEXCLAMATION);
      end;
    end;
//ejecutar crear sistema
    FileAttrs := FileAttrs + faArchive;                                         //q busque creasistema.exe
    if not FindFirst(FInstalacion.dircd.Text+'\instalar\CreaSistema.exe', FileAttrs, sr) = 0 then
    begin
      Application.MessageBox('No se encontro la aplicación','Error', MB_ICONEXCLAMATION);
      FindClose(sr);
    end
    else
    begin
//***se crea el proceso para esperar a q se termine de ejecutar esta aplicación***//
      FillChar(proc_info, sizeof(TProcessInformation), 0);
      FillChar(startinfo, sizeof(TStartupInfo), 0);
      startinfo.cb := sizeof(TStartupInfo);
      if CreateProcess(nil, PChar(FInstalacion.dircd.Text+'\instalar\CreaSistema.exe'), nil, nil, false, CREATE_DEFAULT_ERROR_MODE + NORMAL_PRIORITY_CLASS, nil, nil, startinfo, proc_info) then
        Timer1.Enabled := True
      else
      begin
        CloseHandle(proc_info.hProcess);
        Application.MessageBox('No se pudo ejecutar la aplicación', 'Error', MB_ICONEXCLAMATION);
      end;

Última edición por nosferatu177 fecha: 14-06-2007 a las 17:46:11. Razón: no quedo bien el resaltado del codigo
Responder Con Cita
  #2  
Antiguo 14-06-2007
nosferatu177 nosferatu177 is offline
Miembro
 
Registrado: mar 2007
Posts: 42
Poder: 0
nosferatu177 Va por buen camino
Question terminar aplicacion

como puedes ver cHackAll, los archivos.exe tambien yo los realice, el problema es q al llegar a esa parte me los envia al mismo tiempo , espero se entienda y puedan orientarme, gracias
Responder Con Cita
  #3  
Antiguo 15-06-2007
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Poder: 22
cHackAll Va por buen camino
Cool EPA... super!

Me agrada que hagas tu propio instalador... el problema es sencillo, lo solucionas con una linea. te dejo tu mismo codigo, me tome la libertad de modificarlo un poquito pues habian algunas cosillas innecesarias desde mi punto de vista. En todo caso si no te funciona por algun motivo el nombre de la API que te interesa es WaitForSingleObject;

Código Delphi [-]
    FillChar(startinfo, sizeof(TStartupInfo), 0);
    startinfo.cb := sizeof(TStartupInfo);
    if creabd.Checked then
      if CreateProcess(nil, PChar(FInstalacion.dircd.Text+'\mysql_odbc\CreaBase.exe '+base+' root sqlpr65'), nil, nil, false, CREATE_DEFAULT_ERROR_MODE + NORMAL_PRIORITY_CLASS, nil, nil, startinfo, proc_info) then
      begin
        WaitForSingleObject(proc_info.hProcess, INFINITE);
        Timer1.Enabled := True
      end
      else
        Application.MessageBox('No se pudo ejecutar la base de datos', 'Error', MB_ICONEXCLAMATION);
    if not FileExists(FInstalacion.dircd.Text+'\instalar\CreaSistema.exe') then
      Application.MessageBox('No se encontro el sistema de instalacion','Error', MB_ICONEXCLAMATION)
    else
      if CreateProcess(nil, PChar(FInstalacion.dircd.Text+'\instalar\CreaSistema.exe'), nil, nil, false, CREATE_DEFAULT_ERROR_MODE + NORMAL_PRIORITY_CLASS, nil, nil, startinfo, proc_info) then
        Timer1.Enabled := True
      else
        Application.MessageBox('No se pudo ejecutar el sistema instalador', 'Error', MB_ICONEXCLAMATION);

PD: No se para que usas el TTimer, pero espero no afecte.

Saludos!
Responder Con Cita
  #4  
Antiguo 15-06-2007
nosferatu177 nosferatu177 is offline
Miembro
 
Registrado: mar 2007
Posts: 42
Poder: 0
nosferatu177 Va por buen camino
Smile terminar aplicacion

gracias cHackAll, si funciono !!!
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Terminar con Procedures. alexxino Varios 3 28-01-2007 22:40:57
Terminar la ejecucion rex Varios 5 30-05-2006 03:55:09
Terminar Thread coulthard Internet 3 28-11-2004 22:05:08
Mi aplicacion no puede terminar King Varios 0 08-06-2004 09:24:48
Forzar a terminar a una aplicacion diegofhernando Varios 1 12-08-2003 00:47:40


La franja horaria es GMT +2. Ahora son las 20:07:16.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi