Ver Mensaje Individual
  #17  
Antiguo 12-11-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola.

Si queres evaluar el resultado de ShellExecute podrías hacer algo como:
Código Delphi [-]
...
var
  HINSTANCE: Integer;
  ErrorMSG: string;
begin
  OpenDialog1.Filter:= 'Archivos de registro|*.REG';
  with OpenDialog1 do
    if Execute then
    begin
      HINSTANCE:= ShellExecute(Handle,  'open', 'C:\HAND.CMD', PChar(GetShortName(FileName)), nil, SW_NORMAL);
      if HINSTANCE < 32 then
      begin
        case HINSTANCE of
          0: ErrorMSG:= 'Memoria o recursos insuficientes';
          ERROR_FILE_NOT_FOUND: ErrorMSG:= 'Archivo no encontrado';
          ERROR_PATH_NOT_FOUND: ErrorMSG:= 'Ruta no encontrada';
          SE_ERR_ACCESSDENIED:  ErrorMSGr:= 'Acceso denegado';
          //...
        end;
        MessageBox(Handle, PChar(ErrorMSG), 'ERROR', MB_ICONERROR + MB_OK);
        Application.Terminate;
       end;
    end;
end;

Un saludo.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita