Pegar retorno do ShelExecute

Discussão em 'Interfaces' iniciado por fdantas, Fevereiro 19, 2009.

  1. fdantas

    fdantas Administrator Moderador

    Pegar retorno do ShelExecute

    Código:
    {windows.i}
     
    DEFINE VARIABLE hInstance AS INTEGER.
     
    RUN ShellExecute{&A} IN hpApi(0,
                                  "open",
                                  "xyz.doc",
                                  "",
                                  "",
                                  1,
                                  OUTPUT hInstance).
     
    RUN TestInstance (hInstance).
    IF RETURN-VALUE > "" THEN
       MESSAGE "ShellExecute failed, reason: " SKIP
               RETURN-VALUE
               VIEW-AS ALERT-BOX ERROR.
     
     
     
    PROCEDURE TestInstance :
     
    DEFINE INPUT PARAMETER hInstance AS INTEGER. /* =return value from ShellExecute */
    DEFINE VARIABLE txt AS CHARACTER NO-UNDO.
     
    IF hInstance<0 OR hInstance>32 THEN RETURN "". /* not failed */
     
    CASE hInstance :
      WHEN  0 THEN txt = "The operating system is out of memory or resources.".
      WHEN  2 THEN txt = "The specified file was not found".
      WHEN  3 THEN txt = "The specified path was not found.".
      WHEN  5 THEN txt = "Windows 95 only: The operating system denied " 
                          + "access to the specified file".
      WHEN  8 THEN txt = "Windows 95 only: There was not enough memory to "
                          + "complete the operation.".
      WHEN 10 THEN txt = "Wrong Windows version".
      WHEN 11 THEN txt = "The .EXE file is invalid (non-Win32 .EXE or "
                          + "error in .EXE image).".
      WHEN 12 THEN txt = "Application was designed for a different operating system".
      WHEN 13 THEN txt = "Application was designed for MS-DOS 4.0".
      WHEN 15 THEN txt = "Attempt to load a real-mode program".
      WHEN 16 THEN txt = "Attempt to load a second instance of "
                          + "an application with non-readonly data segments".
      WHEN 19 THEN txt = "Attempt to load a compressed application file".
      WHEN 20 THEN txt = "Dynamic-link library (DLL) file failure".
      WHEN 26 THEN txt = "A sharing violation occurred.".
      WHEN 27 THEN txt = "The filename association is incomplete or invalid.".
      WHEN 28 THEN txt = "The DDE transaction could not be completed " 
                          + "because the request timed out.".
      WHEN 29 THEN txt = "The DDE transaction failed.".
      WHEN 30 THEN txt = "The DDE transaction could not be completed because "
                          + "other DDE transactions were being processed.".
      WHEN 31 THEN txt = "There is no application associated with "
                         + "the given filename extension.".
      WHEN 32 THEN txt = "Windows 95 only: The specified dynamic-link " 
                         + "library was not found.".
      OTHERWISE    txt = "undocumented".
    END.
     
    RETURN txt.
     
    END PROCEDURE.
    
    
  2. cauepor

    cauepor Sem Pontuação

    boa noite, desculpe a pergunta meio besta, mas estou tentando encontrar esta include {windows.i} e não acho em lugar nenhum, poderia me dar o caminho ou aonde baixa-la?
  3. baltazar

    baltazar Membro Participativo

  4. cauepor

    cauepor Sem Pontuação

    putzz, vlw mesmo baltazar!!

Compartilhe esta Página