processutils.cpp

来自「funambol windows mobile plugin source co」· C++ 代码 · 共 33 行

CPP
33
字号
#include "processUtils.h"
#include "pim/ClientSettings.h"
#include "base/startcmd.h"
#include <xstring>
using namespace std;


int startProgram(const wchar_t *app, const wchar_t *cmdline)
{   
    PROCESS_INFORMATION procinfo;
     
    wchar_t *path = NULL;
    path = toWideChar(getRegConfig()->getPath().c_str());
    wstring cmd;
    
    if (path) {
        cmd += path;
        delete [] path;
    }
    cmd += TEXT("\\"); cmd += app;

    LOG.debug("Running: %ls %ls\n", cmd.c_str(), cmdline);
    if( CreateProcess( cmd.c_str(), cmdline,
                        NULL, NULL, FALSE, 0,
                        NULL, NULL, NULL, &procinfo ) ) {
        return procinfo.dwProcessId;
    }
    else {
        //-- maybe the Registry entry is missing, trying startcmd()
        int pid = startcmd(app, cmdline);
        return pid;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?