VC6补丁FileTool


VC6补丁FileTool。博客地址:http://blog.csdn.net/bingdianlanxin,有问题欢迎留言!
资源截图
代码片段和文件信息
// Commands.cpp : implementation file
//

#include “stdafx.h“
#include “FileTool.h“
#include “Commands.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCommands

CCommands::CCommands()
{
m_pApplication = NULL;
}

CCommands::~CCommands()
{
ASSERT (m_pApplication != NULL);
m_pApplication->Release();
}

void CCommands::SetApplicationobject(IApplication* pApplication)
{
// This function assumes pApplication has already been AddRef‘d
//  for us which CDSAddIn did in its QueryInterface call
//  just before it called us.
m_pApplication = pApplication;
}

/////////////////////////////////////////////////////////////////////////////
// CCommands methods

STDMETHODIMP CCommands::AddFileToProject() 
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());

// TODO: Replace this with the actual code to execute this command
//  Use m_pApplication to access the Developer Studio Application object
//  and VERIFY_OK to see error strings in DEBUG builds of your add-in
//  (see stdafx.h)

VERIFY_OK(m_pApplication->EnableModeless(VARIANT_FALSE));

HRESULT hr;
CComPtr m_pDispatch(NULL);
hr=m_pApplication->get_Projects(&m_pDispatch);
if(FAILED(hr))
{
    AfxMessageBox(“Unable to obtain the IProject‘s pointer“);
    return S_FALSE;
}

CComQIPtr m_Project(m_pDispatch);

long count;
hr=m_Project->get_Count(&count);
if(FAILED(hr))
{
    AfxMessageBox(“Unable to obtain the number of projects in the workspace“);
    return S_FALSE;
}

if(count > 0)
{
    CFileDialog AddFiles(TRUE);
    AddFiles.m_ofn.lpstrtitle = “Add Files To Project“;
    AddFiles.m_ofn.lpstrFilter = “All Files(*.*)*.*“;
    AddFiles.m_ofn.Flags =  AddFiles.m_ofn.Flags | OFN_ALLOWMULTISELECT;
    char test[2000];
    test[0]=‘‘;
    AddFiles.m_ofn.lpstrFile = test;
    AddFiles.m_ofn.nMaxFile = 2000;

    if(AddFiles.DoModal() == IDOK)
    {
POSITION position=AddFiles.GetStartPosition();
CString file_name;

m_pDispatch=NULL;
        hr=m_pApplication->get_ActiveProject(&m_pDispatch);
if(FAILED(hr))
{
    AfxMessageBox(“Unable to obtain the ActiveProject pointer“);
    return S_FALSE;
}

CComQIPtr m_ActiveProject(m_pDispatch);
CComBSTR type;

hr=m_ActiveProject->get_Type(&type);
if(FAILED(hr))
{
    AfxMessageBox(“Unable to obtain the ActiveProject type“);
    return S_FALSE;
}
CString s_type(type);
CComQIPtr m_BuildProject;
m_BuildProject=m_ActiveProject;

CComVariant reserved=NULL;

while(position != NULL)
{
    file_name=AddFiles.GetNextPathName(position);
    if(s_type == “Build“)
    {
    hr=m_BuildProject->AddFile(CComBSTR(file_name) reserved);
    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4602  1999-05-27 12:37  FileToolCommands.cpp

     文件       1022  1999-01-05 15:26  FileToolCommands.h

     文件      90259  2011-08-24 13:47  FileToolDebugCommands.obj

     文件      33130  2011-08-24 13:47  FileToolDebugCommands.sbr

     文件      77020  2011-08-24 13:47  FileToolDebugDSAddIn.obj

     文件      23001  2011-08-24 13:47  FileToolDebugDSAddIn.sbr

     文件     134576  2011-08-24 13:47  FileToolDebugFileTool.dll

     文件       1018  2011-08-24 13:47  FileToolDebugFileTool.exp

     文件       1768  2011-08-24 13:47  FileToolDebugFileTool.lib

     文件      71235  2011-08-24 13:47  FileToolDebugFileTool.map

     文件     143326  2011-08-24 13:47  FileToolDebugFileTool.obj

     文件    8688692  2011-08-24 13:47  FileToolDebugFileTool.pch

     文件     877568  2011-08-24 13:47  FileToolDebugFileTool.pdb

     文件       4580  2011-08-24 13:47  FileToolDebugFileTool.res

     文件      27016  2011-08-24 13:47  FileToolDebugFileTool.sbr

     文件       1724  2011-08-24 13:47  FileToolDebugFileTool.tlb

     文件     117957  2011-08-24 13:47  FileToolDebugStdAfx.obj

     文件    1534636  2011-08-24 13:47  FileToolDebugStdAfx.sbr

     文件     246784  2011-08-24 13:47  FileToolDebugvc60.idb

     文件     462848  2011-08-24 13:47  FileToolDebugvc60.pdb

     文件       4296  1999-01-05 15:54  FileToolDSAddIn.cpp

     文件       1333  1999-01-05 15:23  FileToolDSAddIn.h

     文件       4506  1999-01-05 15:17  FileToolFileTool.cpp

     文件        302  1999-01-05 15:17  FileToolFileTool.def

     文件       4752  1999-09-10 12:44  FileToolFileTool.dsp

     文件        539  1999-01-05 15:17  FileToolFileTool.dsw

     文件        724  1999-01-05 15:17  FileToolFileTool.h

     文件      82944  2012-01-12 10:43  FileToolFileTool.ncb

     文件       1138  1999-01-05 15:21  FileToolFileTool.odl

     文件      53760  2012-01-12 10:43  FileToolFileTool.opt

............此处省略28个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)