From: <bl...@us...> - 2003-05-11 17:53:13
|
Update of /cvsroot/cpptool/rfta/src/rftavc7addin In directory sc8-pr-cvs1:/tmp/cvs-serv22820 Added Files: AddIn.cpp AddIn.def AddIn.idl AddIn.rc AddIn.rgs Connect.cpp Connect.h HowToDebugVc7AddIn.txt ReCreateCommands.reg Resource.h rftavc7addin.vcproj stdafx.cpp stdafx.h Log Message: * squeleton for a VC7 plug-in. The toolbar and a menu are added to VC7 interface. Though icones are not displayed. A dialog box is displayed when the command is activated. --- NEW FILE: AddIn.cpp --- // AddIn.cpp : Implementation of DLL Exports. #include "stdafx.h" #include "resource.h" #include "AddIn.h" CAddInModule _AtlModule; // DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { _AtlModule.SetResourceInstance(hInstance); return _AtlModule.DllMain(dwReason, lpReserved); } // Used to determine whether the DLL can be unloaded by OLE STDAPI DllCanUnloadNow(void) { return _AtlModule.DllCanUnloadNow(); } // Returns a class factory to create an object of the requested type STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { return _AtlModule.DllGetClassObject(rclsid, riid, ppv); } // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib HRESULT hr = _AtlModule.DllRegisterServer(); return hr; } // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { HRESULT hr = _AtlModule.DllUnregisterServer(); return hr; } --- NEW FILE: AddIn.def --- ; AddIn.def : Declares the module parameters. EXPORTS DllCanUnloadNow PRIVATE DllGetClassObject PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE --- NEW FILE: AddIn.idl --- // AddIn.idl : IDL source for AddIn // // This file will be processed by the MIDL tool to // produce the type library (AddIn.tlb) and marshalling code. import "oaidl.idl"; import "ocidl.idl"; [ uuid(9D079750-4251-4722-8E52-E8296A611AE8), version(1.0), helpstring("rftavc7addin 1.0 Type Library") ] library rftavc7addinLib { importlib("stdole2.tlb"); [ uuid(D723FA07-0D64-42F6-AC68-127BC7DF3898), helpstring("Connect Class") ] coclass Connect { [default] interface IUnknown; }; }; --- NEW FILE: AddIn.rc --- // Microsoft Visual C++ generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "winres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE BEGIN "resource.h\0" END 2 TEXTINCLUDE BEGIN "#include ""winres.h""\r\n" "\0" END 3 TEXTINCLUDE BEGIN "1 TYPELIB ""AddIn.tlb""\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" BEGIN VALUE "CompanyName", "TODO: <Company name>" VALUE "FileDescription", "TODO: <File description>" VALUE "FileVersion", "1.0.0.1" VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved." VALUE "InternalName", "AddIn.dll" VALUE "OriginalFilename", "AddIn.dll" VALUE "ProductName", "TODO: <Product name>" VALUE "ProductVersion", "1.0.0.1" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END ///////////////////////////////////////////////////////////////////////////// // // REGISTRY // IDR_ADDIN REGISTRY "AddIn.rgs" ///////////////////////////////////////////////////////////////////////////// // // String Table // STRINGTABLE BEGIN IDS_PROJNAME "AddIn" END #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // French (France) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) #ifdef _WIN32 LANGUAGE LANG_FRENCH, SUBLANG_FRENCH #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_RENAMELOCALEVARIABLE BITMAP "res\\renamelocale.bmp" IDB_INLINELOCALEVARIABLE BITMAP "res\\inlinelocale.bmp" IDB_SPLITLOCALEVARIABLE BITMAP "res\\splitlocale.bmp" IDB_REDUCELOCALEVARIABLESCOPE BITMAP "res\\reducescope.bmp" #endif // French (France) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // 1 TYPELIB "AddIn.tlb" ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED --- NEW FILE: AddIn.rgs --- HKCR { RFTA.1 = s 'Connect Class' { CLSID = s '{D723FA07-0D64-42F6-AC68-127BC7DF3898}' } RFTA = s 'Connect Class' { CLSID = s '{D723FA07-0D64-42F6-AC68-127BC7DF3898}' CurVer = s 'RFTA.1' } NoRemove CLSID { ForceRemove '{D723FA07-0D64-42F6-AC68-127BC7DF3898}' = s 'Connect Class' { ProgID = s 'RFTA.1' VersionIndependentProgID = s 'RFTA' ForceRemove 'Programmable' InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } 'TypeLib' = s '{9D079750-4251-4722-8E52-E8296A611AE8}' } } } --- NEW FILE: Connect.cpp --- // Connect.cpp : Implementation of CConnect #include "stdafx.h" #include "AddIn.h" #include "Connect.h" extern CAddInModule _AtlModule; // When run, the Add-in wizard prepared the registry for the Add-in. // At a later time, if the Add-in becomes unavailable for reasons such as: // 1) You moved this project to a computer other than which is was originally created on. // 2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in. // 3) Registry corruption. // you will need to re-register the Add-in by building the MyAddin21Setup project // by right clicking the project in the Solution Explorer, then choosing install. /* CComBSTR("rftavc7addin"), CComBSTR("rftavc7addin"), CComBSTR("Executes the command for rftavc7addin"), VARIANT_TRUE, 59, NULL, EnvDTE::vsCommandStatusSupported+EnvDTE::vsCommandStatusEnabled, &pCreatedCommand)) && (pCreatedCommand)) class NamedCommand { public: CComPtr<EnvDTE::Command> add( const CComPtr<EnvDTE::AddIn> &addIn ) { CComPtr<EnvDTE::Command> command; HRESULT hr = } CComBSTR name_; CComBSTR buttonText_; CComBSTR toolTip_; VARIANT_BOOL msOfficeButton_; long bitmapId_; bool disableFlags_; }; */ #include <stdexcept> class IDTCallError : public std::runtime_error { public: IDTCallError( HRESULT hr ) : std::runtime_error( "IDT call failed" ) , hresult_( hr ) { } HRESULT hresult_; }; inline void checkIDTCall( HRESULT hresult ) { if ( !SUCCEEDED( hresult ) ) throw IDTCallError( hresult ); } void removeCommand( EnvDTE::Commands &commands, const wchar_t *commandName ) { CComBSTR fullCommandName = "RFTA."; fullCommandName += commandName; CComPtr<EnvDTE::Command> pExistingCommand; HRESULT hr = commands.Item( CComVariant( fullCommandName ), 0, &pExistingCommand ); if ( SUCCEEDED(hr) && pExistingCommand ) pExistingCommand->Delete(); } // CConnect STDMETHODIMP CConnect::OnConnection(IDispatch *pApplication, AddInDesignerObjects::ext_ConnectMode ConnectMode, IDispatch *pAddInInst, SAFEARRAY ** /*custom*/ ) { // AFX_MANAGE_STATE(AfxGetStaticModuleState()); // _asm int 3; // comment this out to force an assertion when loading the add-in. HRESULT hr = S_OK; pApplication->QueryInterface(__uuidof(EnvDTE::_DTE), (LPVOID*)&m_pDTE); pAddInInst->QueryInterface(__uuidof(EnvDTE::AddIn), (LPVOID*)&m_pAddInInstance); if(ConnectMode != 5) //5 == AddInDesignerObjects::ext_cm_UISetup) return S_OK; try { CComPtr<EnvDTE::Commands> pCommands; CComPtr<EnvDTE::Command> pCreatedCommand; checkIDTCall( m_pDTE->get_Commands( &pCommands ) ); // Removes existing command (so we can add some as the add-in is updated). // => notes will need to store command name somewhere. removeCommand( *pCommands, L"RenameLocaleVariable" ); removeCommand( *pCommands, L"InlineLocaleVariable" ); removeCommand( *pCommands, L"SplitLocaleVariable" ); removeCommand( *pCommands, L"ReduceLocaleVariableScope" ); CComPtr<EnvDTE::Command> cmdRename = addCommand( *pCommands, L"RenameLocaleVariable", L"Rename locale variable", L"Rename the selected locale variable", IDB_RENAMELOCALEVARIABLE ); CComPtr<EnvDTE::Command> cmdInline = addCommand( *pCommands, L"InlineLocaleVariable", L"Inline locale variable", L"Inline the selected locale variable", IDB_INLINELOCALEVARIABLE ); CComPtr<EnvDTE::Command> cmdSplit = addCommand( *pCommands, L"SplitLocaleVariable", L"Split locale variable", L"Split the selected locale variable declaration", IDB_SPLITLOCALEVARIABLE ); CComPtr<EnvDTE::Command> cmdReduce = addCommand( *pCommands, L"ReduceLocaleVariableScope", L"Reduce locale variable scope", L"Reduce the scope of the selected local variable", IDB_REDUCELOCALEVARIABLESCOPE ); CComPtr<Office::CommandBar> pToolBar = ensureToolBarExist( *pCommands, L"C++ Refactoring Assistant", EnvDTE::vsCommandBarTypeToolbar ); CComPtr<Office::CommandBar> pMenuBar = ensureToolBarExist( *pCommands, L"Refactoring", EnvDTE::vsCommandBarTypeMenu ); int index = 1; associateCommand( cmdRename, pToolBar, pMenuBar, index++ ); associateCommand( cmdInline, pToolBar, pMenuBar, index++ ); associateCommand( cmdSplit, pToolBar, pMenuBar, index++ ); associateCommand( cmdReduce, pToolBar, pMenuBar, index++ ); /* // The stuff below register the command in a menu named "Tool". We might want to do that too. CComPtr<Office::_CommandBars> pCommandBars; CComPtr<Office::CommandBarControl> pCommandBarControl; CComPtr<Office::CommandBar> pMenuBarCommandBar; // When run, the Add-in wizard prepared the registry for the Add-in. // At a later time, the Add-in or its commands may become unavailable for reasons such as: // 1) You moved this project to a computer other than which is was originally created on. // 2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in. // 3) You add new commands or modify commands already defined. // You will need to re-register the Add-in by building the rftavc7addinSetup project, // right-clicking the project in the Solution Explorer, and then choosing install. // Alternatively, you could execute the ReCreateCommands.reg file the Add-in Wizard generated in // the project directory, or run 'devenv /setup' from a command prompt. IfFailGoCheck(m_pDTE->get_Commands(&pCommands), pCommands); if(SUCCEEDED(pCommands->AddNamedCommand(m_pAddInInstance, CComBSTR("RFTARenameLocaleVariable"), CComBSTR("RFTARenameLocaleVariable"), CComBSTR("Rename the selected locale variable"), VARIANT_TRUE, 59, NULL, EnvDTE::vsCommandStatusSupported+EnvDTE::vsCommandStatusEnabled, &pCreatedCommand)) && (pCreatedCommand)) { //Add a button to the tools menu bar. IfFailGoCheck(m_pDTE->get_CommandBars(&pCommandBars), pCommandBars); IfFailGoCheck(pCommandBars->get_Item(CComVariant(L"Tools"), &pMenuBarCommandBar), pMenuBarCommandBar); IfFailGoCheck(pCreatedCommand->AddControl(pMenuBarCommandBar, 1, &pCommandBarControl), pCommandBarControl); } */ return S_OK; } catch ( const IDTCallError &e ) { /* CString message; message.Format( "C++ Refactoring Assistant initialization failed with code: %x", e.hresult_ ); MessageBox( 0, message, "Initialization failed", MB_OK ); */ return e.hresult_; } } CComPtr<EnvDTE::Command> CConnect::addCommand( EnvDTE::Commands &commands, const CComBSTR &commandName, const CComBSTR &commandButtonText, const CComBSTR &commandToolTip, int commandBitmapID ) { CComPtr<EnvDTE::Command> pCreatedCommand; checkIDTCall( commands.AddNamedCommand( m_pAddInInstance, commandName, commandButtonText, commandToolTip, VARIANT_FALSE, commandBitmapID, NULL, EnvDTE::vsCommandStatusSupported + EnvDTE::vsCommandStatusEnabled, &pCreatedCommand ) ); return pCreatedCommand; } CComPtr<Office::CommandBar> CConnect::ensureToolBarExist( EnvDTE::Commands &commands, const CComBSTR &toolBarName, EnvDTE::vsCommandBarType commandBarType ) { CComQIPtr<Office::CommandBar> pToolbar; CComPtr<Office::_CommandBars> pCommandBars; checkIDTCall( m_pDTE->get_CommandBars( &pCommandBars ) ); HRESULT hr = pCommandBars->get_Item( CComVariant( toolBarName ), &pToolbar ); if ( SUCCEEDED(hr) ) // the toolbar already exist, make it visible pToolbar->put_Visible(VARIANT_TRUE); else // the toolbar has not been created yet { CComPtr<Office::CommandBar> pMenubar; if ( commandBarType == EnvDTE::vsCommandBarTypeMenu ) // get top level menu bar checkIDTCall( pCommandBars->get_Item( CComVariant( "MenuBar" ), &pMenubar ) ); CComPtr<IDispatch> pDisp; checkIDTCall( commands.AddCommandBar( (LPWSTR)toolBarName, commandBarType, pMenubar, 4, &pDisp ) ); pToolbar = pDisp; // returned object is not a Office::CommandBar if ( pToolbar == NULL ) throw IDTCallError( E_FAIL ); pToolbar->put_Visible(VARIANT_TRUE); } return pToolbar; } void CConnect::associateCommand( const CComPtr<EnvDTE::Command> &pCommand, const CComPtr<Office::CommandBar> &pToolBar, const CComPtr<Office::CommandBar> &pMenuBar, int index ) { { CComPtr<Office::CommandBarControl> pCommandBarControl; HRESULT hr = pCommand->AddControl( pToolBar, index, &pCommandBarControl ); if ( SUCCEEDED(hr) ) { // make it image only CComQIPtr<Office::_CommandBarButton> pButton( pCommandBarControl ); if ( pButton ) pButton->put_Style( Office::msoButtonIcon ); } } { CComPtr<Office::CommandBarControl> pCommandBarControl; pCommand->AddControl( pMenuBar, index, &pCommandBarControl ); } } STDMETHODIMP CConnect::OnDisconnection(AddInDesignerObjects::ext_DisconnectMode /*RemoveMode*/, SAFEARRAY ** /*custom*/ ) { m_pDTE = NULL; return S_OK; } STDMETHODIMP CConnect::OnAddInsUpdate (SAFEARRAY ** /*custom*/ ) { return S_OK; } STDMETHODIMP CConnect::OnStartupComplete (SAFEARRAY ** /*custom*/ ) { return S_OK; } STDMETHODIMP CConnect::OnBeginShutdown (SAFEARRAY ** /*custom*/ ) { return S_OK; } STDMETHODIMP CConnect::QueryStatus( BSTR bstrCmdName, EnvDTE::vsCommandStatusTextWanted NeededText, EnvDTE::vsCommandStatus *pStatusOption, VARIANT *pvarCommandText ) { if(NeededText == EnvDTE::vsCommandStatusTextWantedNone) { CComBSTR commandName = bstrCmdName; // ::MessageBoxW( 0, commandName, commandName, MB_OK ); // CComBSTR commandName = bstrCmdName; bool enable = false; enable = ( commandName == L"RFTA.RenameLocaleVariable" ) || ( commandName == L"RFTA.InlineLocaleVariable" ) || ( commandName == L"RFTA.SplitLocaleVariable" ) || ( commandName == L"RFTA.ReduceLocaleVariableScope" ); if ( enable ) *pStatusOption = (EnvDTE::vsCommandStatus)(EnvDTE::vsCommandStatusEnabled+EnvDTE::vsCommandStatusSupported); // if(!_wcsicmp(bstrCmdName, L"rftavc7addin.Connect.RFTARenameLocaleVariable")) // { // *pStatusOption = (EnvDTE::vsCommandStatus)(EnvDTE::vsCommandStatusEnabled+EnvDTE::vsCommandStatusSupported); // } } return S_OK; } // Implements IDTCommandTarget STDMETHODIMP CConnect::Exec(BSTR bstrCmdName, EnvDTE::vsCommandExecOption ExecuteOption, VARIANT * /*pvarVariantIn*/, VARIANT * /*pvarVariantOut*/, VARIANT_BOOL *pvbHandled) { *pvbHandled = VARIANT_FALSE; if(ExecuteOption == EnvDTE::vsCommandExecOptionDoDefault) { CComBSTR commandName = bstrCmdName; ::MessageBoxW( 0, commandName, commandName, MB_OK ); *pvbHandled = VARIANT_TRUE; //if(!_wcsicmp(bstrCmdName, L"RFTA.RenameLocaleVariable")) //{ // *pvbHandled = VARIANT_TRUE; // return S_OK; //} } return S_OK; } --- NEW FILE: Connect.h --- // Connect.h : Declaration of the CConnect #pragma once #include "resource.h" // main symbols #pragma warning( disable : 4278 ) //The following #import imports DTE based on it's LIBID #import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("7.0") lcid("0") raw_interfaces_only named_guids #pragma warning( default : 4278 ) // CConnect class ATL_NO_VTABLE CConnect : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CConnect, &CLSID_Connect>, public IDispatchImpl<EnvDTE::IDTCommandTarget, &EnvDTE::IID_IDTCommandTarget, &EnvDTE::LIBID_EnvDTE, 7, 0>, public IDispatchImpl<AddInDesignerObjects::_IDTExtensibility2, &AddInDesignerObjects::IID__IDTExtensibility2, &AddInDesignerObjects::LIBID_AddInDesignerObjects, 1, 0> { public: CConnect() { } DECLARE_REGISTRY_RESOURCEID(IDR_ADDIN) DECLARE_NOT_AGGREGATABLE(CConnect) BEGIN_COM_MAP(CConnect) COM_INTERFACE_ENTRY(AddInDesignerObjects::IDTExtensibility2) COM_INTERFACE_ENTRY(EnvDTE::IDTCommandTarget) COM_INTERFACE_ENTRY2(IDispatch, AddInDesignerObjects::IDTExtensibility2) END_COM_MAP() DECLARE_PROTECT_FINAL_CONSTRUCT() HRESULT FinalConstruct() { return S_OK; } void FinalRelease() { } public: //IDTExtensibility2 implementation: STDMETHOD(OnConnection)(IDispatch * Application, AddInDesignerObjects::ext_ConnectMode ConnectMode, IDispatch *AddInInst, SAFEARRAY **custom); STDMETHOD(OnDisconnection)(AddInDesignerObjects::ext_DisconnectMode RemoveMode, SAFEARRAY **custom ); STDMETHOD(OnAddInsUpdate)(SAFEARRAY **custom ); STDMETHOD(OnStartupComplete)(SAFEARRAY **custom ); STDMETHOD(OnBeginShutdown)(SAFEARRAY **custom ); //IDTCommandTarget implementation: STDMETHOD(QueryStatus)(BSTR CmdName, EnvDTE::vsCommandStatusTextWanted NeededText, EnvDTE::vsCommandStatus *StatusOption, VARIANT *CommandText); STDMETHOD(Exec)(BSTR CmdName, EnvDTE::vsCommandExecOption ExecuteOption, VARIANT *VariantIn, VARIANT *VariantOut, VARIANT_BOOL *Handled); CComPtr<EnvDTE::_DTE> m_pDTE; CComPtr<EnvDTE::AddIn> m_pAddInInstance; private: CComPtr<EnvDTE::Command> addCommand( EnvDTE::Commands &commands, const CComBSTR &commandName, const CComBSTR &commandButtonText, const CComBSTR &commandToolTip, int commandBitmapID ); CComPtr<Office::CommandBar> ensureToolBarExist( EnvDTE::Commands &commands, const CComBSTR &toolBarName, EnvDTE::vsCommandBarType commandBarType ); void associateCommand( const CComPtr<EnvDTE::Command> &pCommand, const CComPtr<Office::CommandBar> &pToolBar, const CComPtr<Office::CommandBar> &pMenuBar, int index ); }; OBJECT_ENTRY_AUTO(__uuidof(Connect), CConnect) --- NEW FILE: HowToDebugVc7AddIn.txt --- * To debug VC7 initialization (inital call to OnConnection()): - comment out the statement '_asm int 3;' at the begining of OnConnection() - compile - You must keep an instance of VC7 running. - Install the debug add-in - Run the ReCreateCommands.reg registry script, this will tell VC7 to reinitialize the add-in on the next startup. - Launch a *NEW* instance of VC7. A message box will appears telling you an exception occured. - Choose 'Cancel' to debug. A new dialog box appear asking you to select the debug to use. DO NOT select 'New instance', choose the already running instance of VC7. - The already running instance of VC7 will ask you wether you want to break or continue. Choose break to debug. * To debug after initialization (command execution): - add the statement '_asm int 3;' were you want to start debugging. This will force a break to occurs. - Follow the step above, but you don't have to bother having an already running VC7 as you can easily launch a new one. --- NEW FILE: ReCreateCommands.reg --- REGEDIT4 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSA\7.0\PreloadAddinState] "RFTA"=dword:1 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\7.0\PreloadAddinState] "RFTA"=dword:1 --- NEW FILE: Resource.h --- //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by AddIn.rc // #define IDS_PROJNAME 100 #define IDR_ADDIN 101 #define IDR_CONNECT 102 #define IDB_RENAMELOCALEVARIABLE 201 #define IDB_INLINELOCALEVARIABLE 202 #define IDB_SPLITLOCALEVARIABLE 203 #define IDB_INLINELOCALEVARIABLE1 204 #define IDB_REDUCELOCALEVARIABLESCOPE 204 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 202 #define _APS_NEXT_COMMAND_VALUE 32768 #define _APS_NEXT_CONTROL_VALUE 201 #define _APS_NEXT_SYMED_VALUE 103 #endif #endif --- NEW FILE: rftavc7addin.vcproj --- <?xml version="1.0" encoding = "Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.00" Name="rftavc7addin" ProjectGUID="{10EDA388-9FAF-4920-8E31-83879630241C}" Keyword="AtlProj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="2" UseOfMFC="2" UseOfATL="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="3" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="4"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" RegisterOutput="TRUE" IgnoreImportLibrary="TRUE" OutputFile="$(OutDir)/$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile=".\AddIn.def" GenerateDebugInformation="TRUE" SubSystem="2" ImportLibrary="$(OutDir)/$(ProjectName).lib" TargetMachine="1"/> <Tool Name="VCMIDLTool" PreprocessorDefinitions="_DEBUG" MkTypLibCompatible="FALSE" TargetEnvironment="1" GenerateStublessProxies="TRUE" TypeLibraryName="$(IntDir)/AddIn.tlb" HeaderFileName="AddIn.h" DLLDataFileName="" InterfaceIdentifierFileName="AddIn_i.c" ProxyFileName="AddIn_p.c"/> <Tool Name="VCPostBuildEventTool" Description="Performing registration" CommandLine="regsvr32 /s /c "$(TargetPath)""/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" AdditionalIncludeDirectories="$(IntDir)"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="2" UseOfMFC="2" UseOfATL="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" InlineFunctionExpansion="1" PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL" StringPooling="TRUE" MinimalRebuild="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" ForceConformanceInForLoopScope="TRUE" RuntimeTypeInfo="TRUE" UsePrecompiledHeader="3" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" RegisterOutput="TRUE" IgnoreImportLibrary="TRUE" OutputFile="$(OutDir)/$(ProjectName).dll" LinkIncremental="2" ModuleDefinitionFile=".\AddIn.def" GenerateDebugInformation="TRUE" SubSystem="2" ImportLibrary="$(OutDir)/$(ProjectName).lib" TargetMachine="1"/> <Tool Name="VCMIDLTool" PreprocessorDefinitions="NDEBUG" MkTypLibCompatible="FALSE" TargetEnvironment="1" GenerateStublessProxies="TRUE" TypeLibraryName="$(IntDir)/AddIn.tlb" HeaderFileName="AddIn.h" DLLDataFileName="" InterfaceIdentifierFileName="AddIn_i.c" ProxyFileName="AddIn_p.c"/> <Tool Name="VCPostBuildEventTool" Description="Performing registration" CommandLine="regsvr32 /s /c "$(TargetPath)""/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" AdditionalIncludeDirectories="$(IntDir)"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> </Configuration> </Configurations> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> <File RelativePath="AddIn.cpp"> </File> <File RelativePath="AddIn.def"> </File> <File RelativePath="AddIn.idl"> </File> <File RelativePath="Connect.cpp"> </File> <File RelativePath="stdafx.cpp"> <FileConfiguration Name="Debug|Win32"> <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1"/> </FileConfiguration> <FileConfiguration Name="Release|Win32"> <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1"/> </FileConfiguration> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc"> <File RelativePath="Connect.h"> </File> <File RelativePath="Resource.h"> </File> <File RelativePath="stdafx.h"> </File> </Filter> <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> <File RelativePath="AddIn.rc"> </File> <File RelativePath="AddIn.rgs"> </File> <File RelativePath="res\inlinelocale.bmp"> </File> <File RelativePath="res\reducescope.bmp"> </File> <File RelativePath="res\renamelocale.bmp"> </File> <File RelativePath="res\splitlocale.bmp"> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: stdafx.cpp --- // stdafx.cpp : source file that includes just the standard includes // AddIn.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" --- NEW FILE: stdafx.h --- // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #pragma once #ifndef STRICT #define STRICT #endif // Modify the following defines if you have to target a platform prior to the ones specified below. // Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later. #define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later. #endif #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later. #define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later. #endif #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. #endif #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later. #define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later. #endif #define _ATL_APARTMENT_THREADED #define _ATL_NO_AUTOMATIC_NAMESPACE #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit // turns off ATL's hiding of some common and often safely ignored warning messages #define _ATL_ALL_WARNINGS #include "resource.h" #include <atlbase.h> #include <atlcom.h> #pragma warning( disable : 4278 ) #pragma warning( disable : 4146 ) //The following #import imports the IDTExtensibility2 interface based on it's LIBID #import "libid:AC0714F2-3D04-11D1-AE7D-00A0C90F26F4" version("1.0") lcid("0") raw_interfaces_only named_guids //The following #import imports MSO based on it's LIBID #import "libid:2DF8D04C-5BFA-101B-BDE5-00AA0044DE52" version("2.2") lcid("0") raw_interfaces_only named_guids #pragma warning( default : 4146 ) #pragma warning( default : 4278 ) #define IfFailGo(x) { hr=(x); if (FAILED(hr)) goto Error; } #define IfFailGoCheck(x, p) { hr=(x); if (FAILED(hr)) goto Error; if(!p) {hr = E_FAIL; goto Error; } } class DECLSPEC_UUID("9D079750-4251-4722-8E52-E8296A611AE8") rftavc7addinLib; using namespace ATL; class CAddInModule : public CAtlDllModuleT< CAddInModule > { public: CAddInModule() { m_hInstance = NULL; } DECLARE_LIBID(__uuidof(rftavc7addinLib)) inline HINSTANCE GetResourceInstance() { return m_hInstance; } inline void SetResourceInstance(HINSTANCE hInstance) { m_hInstance = hInstance; } private: HINSTANCE m_hInstance; }; extern CAddInModule _AtlModule; |