| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 
 |         CString strInstall= str + "\\Install.exe";
 
        SHELLEXECUTEINFO ShellExInfo; 
        ZeroMemory(&ShellExInfo, sizeof(SHELLEXECUTEINFO)); 
        ShellExInfo.cbSize = sizeof( SHELLEXECUTEINFO ); 
 
        ShellExInfo.lpFile = strInstall; 
        ShellExInfo.fMask  = SEE_MASK_NOCLOSEPROCESS; 
        ShellExInfo.lpVerb = _T("open"); 
        ShellExInfo.nShow  = SW_SHOW ; 
 
        DWORD NumErreur = ERROR_SUCCESS;
        CString str;
        DWORD Taille = 255;
 
        CString strOut = "ShellExecuteEx "+strInstall;
        OutputDebugString(strOut);
        SetLastError( ERROR_SUCCESS );
        if(ShellExecuteEx(&ShellExInfo)) 
        { 
            NumErreur = GetLastError();
            SetLastError( ERROR_SUCCESS );
            FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, NumErreur, 0, str.GetBuffer( Taille ) , Taille , NULL );
            str.ReleaseBuffer();
            str = str + "\n";
            OutputDebugString(str);
 
            OutputDebugString("ShellExecuteEx reussi \n");
            WaitForSingleObject(ShellExInfo.hProcess, INFINITE);
 
            NumErreur = GetLastError();
            SetLastError( ERROR_SUCCESS );
            FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, NumErreur, 0, str.GetBuffer( Taille ) , Taille , NULL );
            str.ReleaseBuffer();
            str = str + "\n";
            OutputDebugString(str);
 
            CloseHandle(ShellExInfo.hProcess);
        }
        else
        {
            OutputDebugString("ShellExecuteEx echec");
            CloseHandle(ShellExInfo.hProcess); 
            return FALSE;
        }
 
        /*
        if( ShellExecute(NULL,"open",strInstall,"","",SW_NORMAL ) )
        {
            OutputDebugString("ShellExecute succes ");
        }
        else
        {
            OutputDebugString("ShellExecute echec ");
        }
        */
 
 
    }
 
    str += "\\Program.exe";
 
    ShellExecute(NULL,"open",str,"","",SW_NORMAL ); | 
Partager