Newsgroup: it.comp.lang.delphi
Titolo: ShellExecute

Ho letto da qualche parte che se shellexecute ritorna un valore < 33 è un
errore.... Vorrei sapere dove posso trovare questa lista di errori in
particolare il 2.
Grazie.....
Un altra cosa cosa posso usare invece della shellexecute, conosciete altro a
me serve x lanciare un exe
Ciao Ciao

 me serve x lanciare un exe
CreateProcess() -- ShellExecuteEx()
--
- Carlo -
cbertu81(at)libero(dot)it

function GetErrMsg: string;
var
  i: Integer;
  ErrorCode: Integer;
  Len: Integer;
  Buffer: array[0..255] of Char;
begin
  ErrorCode:=GetLastError;
  Len := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM or
    FORMAT_MESSAGE_ARGUMENT_ARRAY, nil, ErrorCode, 0, Buffer,
    SizeOf(Buffer), nil);
  while (Len > 0) and (Buffer[Len - 1] in [#0..#32, '.']) do Dec(Len);
  SetString(Result, Buffer, Len);
  For i := 1 to Length(Result) do    // Iterate
  begin
    If Result[i]=#10 then Result[i]:=#32;
    If Result[i]=#13 then Result[i]:=#32;
  end;    // for
end;
Lancia questa funzione dopo il comando, ritorna una stringa che il sistema
rilascia come errore.
Cmq l'errore 2 č quello piů usuale, cioč il file che hai tentato di lanciare
non č stato semplicemente trovato.
Ti riporto un pezzo della unit Windows del Delphi dove sono dichiarate le
costanti di errore di sistema, forse sei vuoi gestire gli errori in ritorno
le dovrai usare:
   { Incorrect function. }
  ERROR_INVALID_FUNCTION = 1;   { dderror }
  {$EXTERNALSYM ERROR_INVALID_FUNCTION}
  { The system cannot find the file specified. }
  ERROR_FILE_NOT_FOUND = 2;
  {$EXTERNALSYM ERROR_FILE_NOT_FOUND}
  { The system cannot find the path specified. }
  ERROR_PATH_NOT_FOUND = 3;
  {$EXTERNALSYM ERROR_PATH_NOT_FOUND}
  { The system cannot open the file. }
  ERROR_TOO_MANY_OPEN_FILES = 4;
  {$EXTERNALSYM ERROR_TOO_MANY_OPEN_FILES}
  { Access is denied. }
  ERROR_ACCESS_DENIED = 5;
  {$EXTERNALSYM ERROR_ACCESS_DENIED}
  { The handle is invalid. }
  ERROR_INVALID_HANDLE = 6;
  {$EXTERNALSYM ERROR_INVALID_HANDLE}
  { The storage control blocks were destroyed. }
  ERROR_ARENA_TRASHED = 7;
  {$EXTERNALSYM ERROR_ARENA_TRASHED}
  { Not enough storage is available to process this command. }
  ERROR_NOT_ENOUGH_MEMORY = 8;   { dderror }
  {$EXTERNALSYM ERROR_NOT_ENOUGH_MEMORY}
  { The storage control block address is invalid. }
  ERROR_INVALID_BLOCK = 9;
  {$EXTERNALSYM ERROR_INVALID_BLOCK}
  { The environment is incorrect. }
  ERROR_BAD_ENVIRONMENT = 10;
  {$EXTERNALSYM ERROR_BAD_ENVIRONMENT}
  { An attempt was made to load a program with an incorrect format. }
  ERROR_BAD_FORMAT = 11;
  {$EXTERNALSYM ERROR_BAD_FORMAT}
  { The access code is invalid. }
  ERROR_INVALID_ACCESS = 12;
  {$EXTERNALSYM ERROR_INVALID_ACCESS}
  { The data is invalid. }
  ERROR_INVALID_DATA = 13;
  {$EXTERNALSYM ERROR_INVALID_DATA}
  { Not enough storage is available to complete this operation. }
  ERROR_OUTOFMEMORY = 14;
  {$EXTERNALSYM ERROR_OUTOFMEMORY}
  { The system cannot find the drive specified. }
  ERROR_INVALID_DRIVE = 15;
  {$EXTERNALSYM ERROR_INVALID_DRIVE}
  { The directory cannot be removed. }
  ERROR_CURRENT_DIRECTORY = $10;
  {$EXTERNALSYM ERROR_CURRENT_DIRECTORY}
  { The system cannot move the file }
  { to a different disk drive. }
  ERROR_NOT_SAME_DEVICE = 17;
  {$EXTERNALSYM ERROR_NOT_SAME_DEVICE}
  { There are no more files. }
  ERROR_NO_MORE_FILES = 18;
  {$EXTERNALSYM ERROR_NO_MORE_FILES}
  { The media is write protected. }
  ERROR_WRITE_PROTECT = 19;
  {$EXTERNALSYM ERROR_WRITE_PROTECT}
  { The system cannot find the device specified. }
  ERROR_BAD_UNIT = 20;
  {$EXTERNALSYM ERROR_BAD_UNIT}
  { The device is not ready. }
  ERROR_NOT_READY = 21;
  {$EXTERNALSYM ERROR_NOT_READY}
  { The device does not recognize the command. }
  ERROR_BAD_COMMAND = 22;
  {$EXTERNALSYM ERROR_BAD_COMMAND}
  { Data error (cyclic redundancy check) }
  ERROR_CRC = 23;
  {$EXTERNALSYM ERROR_CRC}
  { The program issued a command but the command length is incorrect. }
  ERROR_BAD_LENGTH = 24;
  {$EXTERNALSYM ERROR_BAD_LENGTH}
  { The drive cannot locate a specific area or track on the disk. }
  ERROR_SEEK = 25;
  {$EXTERNALSYM ERROR_SEEK}
  { The specified disk or diskette cannot be accessed. }
  ERROR_NOT_DOS_DISK = 26;
  {$EXTERNALSYM ERROR_NOT_DOS_DISK}
  { The drive cannot find the sector requested. }
  ERROR_SECTOR_NOT_FOUND = 27;
  {$EXTERNALSYM ERROR_SECTOR_NOT_FOUND}
  { The printer is out of paper. }
  ERROR_OUT_OF_PAPER = 28;
  {$EXTERNALSYM ERROR_OUT_OF_PAPER}
  { The system cannot write to the specified device. }
  ERROR_WRITE_FAULT = 29;
  {$EXTERNALSYM ERROR_WRITE_FAULT}
  { The system cannot read from the specified device. }
  ERROR_READ_FAULT = 30;
  {$EXTERNALSYM ERROR_READ_FAULT}
  { A device attached to the system is not functioning. }
  ERROR_GEN_FAILURE = 31;
  {$EXTERNALSYM ERROR_GEN_FAILURE}