Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C++

Customized Visual Studio .NET package: your fully integrated document window inside the IDE

Rate me:
Please Sign up or sign in to vote.
4.72/5 (20 votes)
20 Dec 200313 min read 63.7K   1.1K   39  
Create a fully integrated document window inside the Visual Studio IDE.
#include "StdAfx.h"

#include "Persist.h"

START_IMPL_SPY(IVsPersistDocData,13)

SPY_STUB_SILENT(0)//,"        IVsPersistDocData::")
SPY_STUB_SILENT(1)//,"        IVsPersistDocData::")
SPY_STUB_SILENT(2)//,"        IVsPersistDocData::")
//SPY_STUB_(3,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub3(void* pThis, void* p1 )
{
	CDbg::Trace( "       IVsPersistDocData::Stub3(0x%p, p1=0x%p ) = S_OK\n", pThis, p1 );
	//CALL_METHOD2(3,pThis,p1);
	return S_OK; // probably must be checked
}

//SPY_STUB_SILENT(4)//(4,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub4(void* pThis, BOOL* p1 )
{
	// always called
	//CDbg::Trace( "       IVsPersistDocData::Stub3(0x%p, p1=0x%p )\n", pThis, p1 );
	CALL_METHOD2(4,pThis,p1); // on exit p1 must be set on TRUE if doc has been changed and not sabed yet.
	return S_OK;
}

//SPY_STUB_(5,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub5(void* pThis, void* p1 )
{
	CDbg::Trace( "       IVsPersistDocData::Stub5(0x%p, p1=0x%p ) = E_NOTIMPL\n", pThis, p1 );
	//CALL_METHOD2(3,pThis,p1);
	return E_NOTIMPL;
}
//SPY_STUB_(6,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub6(void* pThis, void* p1 )
{
	CDbg::Trace( "       IVsPersistDocData::Stub6(0x%p, p1=0x%p ) = S_OK\n", pThis, p1 );
	//CALL_METHOD2(3,pThis,p1);
	return S_OK;
}


//SPY_STUB_(7,"        IVsPersistDocData::")
STDMETHODIMP PD_SaveDocData(void* pThis, DWORD dwFlg, LPWSTR* pbstr, BOOL *pbCn )
{
	CDbg::Trace( "       IVsPersistDocData::SaveDocData(0x%p, Flg=%x, [out]pbstr=%S (0x%p), [out]*pb=%d )\n",
					pThis, dwFlg, *pbstr, pbstr, *pbCn );
	HRESULT hr;
	CALL_METHOD4(7,pThis,dwFlg,pbstr,pbCn);
	GET_RET_VAL(hr);

	CDbg::Trace( "       IVsPersistDocData::SaveDocData(,,[out]pbstr=%S (0x%p), cancld=%d ) = %X\n",
							*pbstr, pbstr, *pbCn );
	return S_OK;
}

//SPY_STUB_(8,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub8(void* pThis )
{
	CDbg::Trace( "       IVsPersistDocData::Stub8(0x%p ) = S_OK\n", pThis );
	//CALL_METHOD2(3,pThis,p1);
	return S_OK;
}


//SPY_STUB_(9,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub9(void* pThis, void* p1, void* p2, void* p3 )
{
	CDbg::Trace( "       IVsPersistDocData::Stub9(0x%p, p1=0x%p, p2=0x%p, p3=0x%p ) = S_OK\n", pThis, p1, p2, p3 );
	//CALL_METHOD2(3,pThis,p1);
	return S_OK;
}


//SPY_STUB_(10,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub10(void* pThis, void* p1, void* p2, void* p3, void* p4 )
{
	CDbg::Trace( "       IVsPersistDocData::Stub10(0x%p, p1=0x%p, p2=0x%p, p3=0x%p, p4=0x%p ) = S_OK\n",
						pThis, p1, p2, p3, p4 );
	//CALL_METHOD2(3,pThis,p1);
	return S_OK;
}

//SPY_STUB_(11,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub11(void* pThis, void* p1 )
{
	CDbg::Trace( "       IVsPersistDocData::SetChanged(0x%p, p1=0x%p ) = S_OK\n", pThis, p1 );
	CALL_METHOD2(11,pThis,p1);
	return S_OK;
}

//SPY_STUB_(12,"        IVsPersistDocData::")
STDMETHODIMP PD_Stub12(void* pThis, void* p1 )
{
	CDbg::Trace( "       IVsPersistDocData::Stub12(0x%p, p1=0x%p )\n", pThis, p1 );
	HRESULT hr;
	CALL_METHOD2(12,pThis,p1);
	GET_RET_VAL(hr);
	CDbg::Trace( "       IVsPersistDocData::Stub12( ) = %x\n", hr );
	return S_OK;
}


SPY_START_VTBL(13)
	SPY_ENTRY(0)
	SPY_ENTRY(1)
	SPY_ENTRY(2)
	SPY_ENTRY_(PD_Stub3,3)
	SPY_ENTRY_(PD_Stub4,4)
	SPY_ENTRY_(PD_Stub5,5)
	SPY_ENTRY_(PD_Stub6,6)
	SPY_ENTRY_(PD_SaveDocData,7)
	SPY_ENTRY_(PD_Stub8,8)
	SPY_ENTRY_(PD_Stub9,9)
	SPY_ENTRY_(PD_Stub10,10)
	SPY_ENTRY_(PD_Stub11,11)
	SPY_ENTRY_(PD_Stub12,12)
SPY_END_VTBL()

END_IMPL_SPY()

//============================================================================
//============================================================================

START_IMPL_SPY(IPersistFileFormat,11)

SPY_STUB_SILENT(0)//,"        IPersistFileFormat::")
SPY_STUB_SILENT(1)//,"        IPersistFileFormat::")
SPY_STUB_SILENT(2)//,"        IPersistFileFormat::")
//SPY_STUB_(3,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub3(void* pThis, void* p1 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub3(0x%p, p1=0x%p ) = E_NOTIMPL\n", pThis, p1 );
	return E_NOTIMPL;
}
//SPY_STUB_(4,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub4(void* pThis, void* p1 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub4(0x%p, p1=0x%p ) = E_NOTIMPL\n", pThis, p1 );
	return E_NOTIMPL;
}

//SPY_STUB_(5,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub5(void* pThis, void* p1 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub5(0x%p, p1=0x%p ) = E_NOTIMPL\n", pThis, p1 );
	return E_NOTIMPL;
}

//SPY_STUB_(6,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub6(void* pThis, void* p1, void* p2, void* p3 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub6(0x%p, p1=0x%p, p2=0x%p, p3=0x%p  ) = E_NOTIMPL\n", pThis, p1, p2, p3 );
	return E_NOTIMPL;
}
//SPY_STUB_(7,"        IPersistFileFormat::")
STDMETHODIMP PF_Save(void* pThis, LPCWSTR szFName, BOOL bRem, DWORD nFormIndx )
{
	CDbg::Trace( "       IPersistFileFormat::Save(0x%p, name=%S (0x%p), bRem=%d, indx=%d  )\n",
							pThis, szFName, szFName, bRem, nFormIndx );
	HRESULT hr;
	CALL_METHOD4(7,pThis,szFName,bRem,nFormIndx);
	GET_RET_VAL(hr);
	CDbg::Trace( "       IPersistFileFormat::Save( ) = %x\n", hr );
	return hr;
}

//SPY_STUB_(8,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub8(void* pThis, void* p1 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub8(0x%p, p1=0x%p ) = S_OK\n", pThis, p1 );
	return S_OK;
}
//SPY_STUB_(9,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub9(void* pThis, void* p1, void* p2 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub9(0x%p, p1=0x%p, p2=0x%p )\n", pThis, p1, p2 );
	HRESULT hr;
	CALL_METHOD3(9,pThis,p1,p2);
	GET_RET_VAL(hr);
	CDbg::Trace( "       IPersistFileFormat::Stub9( ) = %x\n", hr );
	return hr;
}


//SPY_STUB_(10,"        IPersistFileFormat::")
STDMETHODIMP PF_Stub10(void* pThis, void* p1 )
{
	CDbg::Trace( "       IPersistFileFormat::Stub10(0x%p, p1=0x%p )\n", pThis, p1 );
	HRESULT hr;
	CALL_METHOD2(10,pThis,p1);
	GET_RET_VAL(hr);
	CDbg::Trace( "       IPersistFileFormat::Stub10( ) = %x\n", hr );
	return hr;
}


SPY_START_VTBL(11)
	SPY_ENTRY(0)
	SPY_ENTRY(1)
	SPY_ENTRY(2)
	SPY_ENTRY_(PF_Stub3,3)
	SPY_ENTRY_(PF_Stub4,4)
	SPY_ENTRY_(PF_Stub5,5)
	SPY_ENTRY_(PF_Stub6,6)
	SPY_ENTRY_(PF_Save,7)
	SPY_ENTRY_(PF_Stub8,8)
	SPY_ENTRY_(PF_Stub9,9)
	SPY_ENTRY_(PF_Stub10,10)
SPY_END_VTBL()

END_IMPL_SPY()

By viewing downloads associated with this article you agree to the Terms of Service 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.

License

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


Written By
Web Developer
United States United States
For the last 7 years I have developed software in real-time/embedded and MS-Windows environments for military and civil markets. I hold B.Sc. degree in computer engineering. Living in Ontario, Canada, I like hiking and traveling in general. Currently, I'm looking for employment opportunity inside the GTA.

Comments and Discussions