openvc_demo.zip
ExtensionAddin.awx
ExtensionAddin
ExtensionAddin.dsp
ExtensionAddin.dsw
res
cd1.bmp
cd1_256.bmp
ExtensionAddin.ico
Template
Commands.rgs
confirm.inf
DSAddin.rgs
newproj.inf
res
TBarLrge.bmp
TBarMedm.bmp
root.def
OpenVC.dll
OpenVC
Commands.rgs
GridCtrl_src
Experimental Upgrades
OpenVC.def
OpenVC.dsp
OpenVC.dsw
OPENVC.tlb
OpenVCAddin.rgs
res
TBarLrge.bmp
TBarMedm.bmp
TreeColumn_src
Undocumented Visual C.doc
|
// DSAddin.cpp : Implementation of C$$ADDIN_OBJNAME$$
#include "stdafx.h"
#include "$$root$$.h"
#include "$$ADDIN_OBJNAME$$Addin.h"
/////////////////////////////////////////////////////////////////////////////
// C$$ADDIN_OBJNAME$$
///////////////////////////////////////////////////////////////////////////////
// IDSAddin
STDMETHODIMP C$$ADDIN_OBJNAME$$::OnConnection(IApplication* piApplication, VARIANT_BOOL bFirstTime, long dwCookie, VARIANT_BOOL* pbOnConnection)
{
// prepare to fail!
*pbOnConnection = VARIANT_FALSE;
// create our command object
CCommandsObj::CreateInstance(&m_pCommands);
m_pCommands->AddRef();
m_pCommands->m_piApplication = piApplication;
CComQIPtr<IDispatch> piDispCmds = m_pCommands;
// tell VC about us:
if (FAILED(piApplication->SetAddInInfo((long)_Module.GetModuleInstance(), piDispCmds, IDR_TOOLBAR_MEDIUM, IDR_TOOLBAR_LARGE, dwCookie)))
return S_OK;
// register our commands with VC
VARIANT_BOOL bRet;
_bstr_t bstrCmd,
bstrSampleCommand = "SampleCommand";
// SampleCommand
bstrCmd = "SampleCommand\nSampleCommand\nA Sample Addin Command\nSampleCommand";
if (FAILED(piApplication->AddCommand(bstrCmd, bstrSampleCommand, 0, dwCookie, &bRet) || VARIANT_FALSE == bRet))
return S_OK;
// create toolbar:
if (VARIANT_TRUE == bFirstTime)
{
piApplication->AddCommandBarButton(dsGlyph, bstrSampleCommand, dwCookie);
}
// success
*pbOnConnection = VARIANT_TRUE;
return S_OK;
}
STDMETHODIMP C$$ADDIN_OBJNAME$$::OnDisconnection(VARIANT_BOOL bLastTime)
{
// cleanup!
m_pCommands->Release();
m_pCommands = NULL;
return S_OK;
}
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here