Exemplo n.º 1
0
void rho_wmsys_run_appW(const wchar_t* szPath, const wchar_t* szParams )
{
    SHELLEXECUTEINFO se = {0};
    se.cbSize = sizeof(SHELLEXECUTEINFO);
    se.fMask = SEE_MASK_NOCLOSEPROCESS;
    se.lpVerb = L"Open";
    se.nShow = SW_SHOWNORMAL;

    StringW strAppNameW = szPath;
    for(int i = 0; i<(int)strAppNameW.length();i++)
    {
        if ( strAppNameW.at(i) == '/' )
            strAppNameW.at(i) = '\\';
    }
    se.lpFile = strAppNameW.c_str();

    if ( szParams && *szParams )
        se.lpParameters = szParams;

    if ( !ShellExecuteEx(&se) )
        LOG(ERROR) + "Cannot execute: " + strAppNameW + ";Error: " + GetLastError();

    if(se.hProcess)
        CloseHandle(se.hProcess); 
}
Exemplo n.º 2
0
void rho_wmsys_run_app(const char* szPath, const char* szParams )
{
    SHELLEXECUTEINFO se = {0};
    se.cbSize = sizeof(SHELLEXECUTEINFO);
    se.fMask = SEE_MASK_NOCLOSEPROCESS;
    se.lpVerb = L"Open";

    StringW strAppNameW;
    convertToStringW(szPath, strAppNameW);
    for(int i = 0; i<(int)strAppNameW.length();i++)
    {
        if ( strAppNameW.at(i) == '/' )
            strAppNameW.at(i) = '\\';
    }
    se.lpFile = strAppNameW.c_str();

    StringW strParamsW;
    if ( szParams && *szParams )
    {
        convertToStringW(szParams, strParamsW);
        se.lpParameters = strParamsW.c_str();
    }

    ShellExecuteEx(&se);
}