 |
Club Builder Foro de C++Builder en español
|
| Ver tema anterior :: Ver tema siguiente |
| Autor |
Mensaje |
Manuel H.C. Lt JG


Registrado: 20 Ago 2002Mensajes: 61Ubicación: Madrid (España)
|
Publicado: Mie 16 Oct, 2002 5:23 pm Asunto: Arrancar Aplicacion |
|
|
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 |
|
 |
lycopersium Lt


Registrado: 12 Oct 2002Mensajes: 90Ubicación: Roquetas de Mar - Almería
|
Publicado: Mie 16 Oct, 2002 7:17 pm Asunto: |
|
|
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.
 |
|
| Volver arriba |
|
 |
Manuel H.C. Lt JG


Registrado: 20 Ago 2002Mensajes: 61Ubicación: Madrid (España)
|
Publicado: Mie 16 Oct, 2002 8:24 pm Asunto: Arrancar Aplicacion |
|
|
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 |
|
 |
|
|
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
|
© 2002–2026 Club Builder · Funciona con phpBB.
|