Club Builder - Foros de discusión Club Builder
Foro de C++Builder en español
 
 FAQFAQ   BuscarBuscar   MiembrosMiembros   Grupos de UsuariosGrupos de Usuarios   RegistrarseRegistrarse 
 PerfilPerfil   Entra para ver tus mensajes privadosEntra para ver tus mensajes privados   EntrarEntrar 

Arrancar Aplicacion

 
Publicar nuevo tema   Responder al tema    Foros de discusión -> Consultas
Ver tema anterior :: Ver tema siguiente  
Autor Mensaje
Mensaje    Asunto: Arrancar Aplicacion Responder citando

Saludos al Foro,tengo un TButton con el que arranco una aplicacion desde
dentro de otra,pero quiero detectar si se realizo correctamente,se me
ocurrio este codigo pero no me va a ver si me podeis hechar una mano,un saludo y gracias anticipadas.



void __fastcall TForm1::Button1Click(TObject *Sender)
{

bool nul;
AnsiString ElIExplorer2 = "C:\\Archivos de programa\\Outlook
Expres\\msimn.exe";
nul=ShellExecute(NULL, "open",ElIExplorer2.c_str(),NULL, NULL,
SW_SHOWNORMAL);
ShowMessage(nul ? "Aplicacion Arrancada" : "No arranco Aplicacion");



}
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Shocked

El shellexecute no devuelve bool. El tipo es void *. Puedes hacer un casting de la variable void * a int y así obtener el numero de error. Si es el numero es mayor q 32 es q se ha ejecutado bien. Si es menor o igual no ha funcionado.

el tipo de error viene en la ayuda del api de windows. Por si no la tienes aqui t lo pongo aunq sa deskuadrao un poco

Value Meaning
0 The operating system is out of memory or resources.
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUND The specified path was not found.
ERROR_BAD_FORMAT The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
SE_ERR_ACCESSDENIED The operating system denied access to the specified file.
SE_ERR_ASSOCINCOMPLETE The filename association is incomplete or invalid.
SE_ERR_DDEBUSY The DDE transaction could not be completed because other DDE transactions were being processed.
SE_ERR_DDEFAIL The DDE transaction failed.
SE_ERR_DDETIMEOUT The DDE transaction could not be completed because the request timed out.
SE_ERR_DLLNOTFOUND The specified dynamic-link library was not found.
SE_ERR_FNF The specified file was not found.
SE_ERR_NOASSOC There is no application associated with the given filename extension.
SE_ERR_OOM There was not enough memory to complete the operation.
SE_ERR_PNF The specified path was not found.
SE_ERR_SHARE A sharing violation occurred.

Confused
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Arrancar Aplicacion Responder citando

Gracias lycopersium,me as dado la solucion,asi a quedado por si le interesa a alguno


void __fastcall TForm1::Button1Click(TObject *Sender)
{
int num;
void *nul;
AnsiString ElIExplorer2 = "C:\\Archivos de programa\\Outlook Express\\msimn.exe";
nul=ShellExecute(NULL, "open",ElIExplorer2.c_str(),NULL, NULL,
SW_SHOWNORMAL);
num=(int)nul;
if(num <= 32)
ShowMessage("La aplicacion no se pudo arrancar");
}


un saludo y gracias.
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mostrar mensajes de anteriores:   
Cambiar a:  
No puedes publicar temas nuevos en este foro
No puedes responder a temas en este foro
No puedes editar tus mensajes en este foro
No puedes borrar tus mensajes en este foro
No puedes votar en las encuestas de este foro


Hosting WordPress Indedmedia desde 3,99 €
© 2002–2026 Club Builder · Funciona con phpBB.