【旧文章搬运】VC插件中如何获取当前工程的工作目录

原文发表于百度空间,2014-09-24
==========================================================================

好难找的资料,记录下。。。。

// Get active project
CComPtr<IDispatch> pDisp;

CComQIPtr<IGenericProject, &IID_IGenericProject> pPrj;
m_pApplication->get_ActiveProject(&pDisp); // m_pApplication是IApplication接口
if(pDisp == NULL)
{
MessageBox(NULL, "Please open project at first!", "Along Addin", MB_OK);
return S_FALSE;
}
pPrj = pDisp;
pPrj->QueryInterface(IID_IGenericProject, (void**) &m_pProject);

// Get project path
    CComBSTR bstrPrjPath;
    CString strPrjPath;
    m_pProject->get_FullName(&bstrPrjPath);

 

posted @ 2018-12-27 10:57  黑月教主  阅读(219)  评论(0编辑  收藏  举报