zoukankan      html  css  js  c++  java
  • 获取当前进程的名称

    #include "atlstr.h"

    /*********************************************************************
    *
    * Function : GetMouduleName
    *
    * Description : 获取当前进程的名称和路径
    *
    *
    * Parameters :
    * :
    *
    * Returns : Nothing.
    *
    *********************************************************************/
    void GetMouduleName(CString &strMoudle, CString &strPathExe)
    {
    TCHAR szAppPath[_MAX_PATH] = {0};
    ::GetModuleFileName(NULL, szAppPath, _MAX_PATH);
    strPathExe = szAppPath;

    TCHAR szExt[_MAX_EXT] = {0};
    TCHAR szDocName[_MAX_FNAME] = {0};
    _tsplitpath_s(szAppPath, NULL, 0, NULL, 0, szDocName, _MAX_FNAME, szExt, _MAX_EXT);
    strMoudle = CString(szDocName) + CString(szExt);
    strMoudle.MakeUpper();
    }


    int main()
    {
    CString m_strExeName; // exe name
    CString m_strExePath; // exe path

    GetMouduleName(m_strExeName, m_strExePath);


    return 0;
    }

  • 相关阅读:
    自动化CodeReview
    10个有关RESTful API良好设计的最佳实践
    ASP.NET Core 获取控制器上的自定义属性
    [转] Autofac创建实例的方法总结
    PetaPoco
    LogViewer
    hdoj:2047
    hdoj:2046
    hdoj:2045
    hdoj:2044
  • 原文地址:https://www.cnblogs.com/roea1/p/14759783.html
Copyright © 2011-2022 走看看