分享

ShellExecuteEx写类似system函数

 DavinTang 2010-12-10

    封装成一个小的函数,来代替system函数
    void xsystem(const TCHAR* cmd, const TCHAR* par, int nShow)
   {
    SHELLEXECUTEINFO ShExecInfo = {0};
    ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
    ShExecInfo.hwnd = NULL;
    ShExecInfo.lpVerb = NULL;
    ShExecInfo.lpFile = cmd;
    ShExecInfo.lpParameters = par;
    ShExecInfo.lpDirectory = NULL;
    ShExecInfo.nShow = nShow;
    ShExecInfo.hInstApp = NULL;
    ShellExecuteEx(&ShExecInfo);
    WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
   }

如关闭桌面程序
xsystem(_T("taskkill.exe"), _T("/f /im explorer.exe"), SW_HIDE);

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多