home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1999 January
/
pcwk_01_1999.iso
/
Wtestowe
/
Vistdstd
/
Install
/
Data.Z
/
MFC4_vsl.AWX
/
TEMPLATE
/
VROOT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-03-07
|
4KB
|
139 lines
//*****************************************************************************
// V$$ROOT$$.CPP - Generated by the "MFC VAddon VSL Wizard."
// Copyright (C) 1997 Visio Corporation. All rights reserved.
#include "stdafx.h"
#include "v$$root$$.h" // Your wizard-generated subclass of VAddon
// The name that you give the V$$safe_root$$ in its constructor
// is the text which shows up in the Visio Tools/Macros menu.
// _T(" - DEBUG") is automatically appended to the debug version
// for you by the VAddon class:
V$$safe_root$$ g_v$$safe_root$$Addon(_T("$$root$$"));
//*****************************************************************************
// Constructor and destructor:
V$$safe_root$$::V$$safe_root$$(LPCTSTR pName) :
VAddon(ATTS, VAO_ENABLEALWAYS, 0, 0, pName)
{
}
V$$safe_root$$::~V$$safe_root$$()
{
}
//*****************************************************************************
// VAddon Overrides:
// The Run method is pure virtual, with no implementation
// in the parent class. This method *MUST* be overridden,
// but it doesn't *HAVE* to do anything. (As you can see below,
// we're basically just returning VAORC_SUCCESS.)
// The code in Run gets executed when the user chooses the
// Visio Tools menu item corresponding to your addon. It also
// gets executed when a shape sheet cell formula RUNADDON or
// RUNADDONWARGS gets evaluated.
VAORC V$$safe_root$$::Run(LPVAOV2LSTRUCT pV2L)
{
CVisioApplication app;
if (SUCCEEDED(GetApp(app)))
{
MessageBeep(MB_OK);
}
return VAORC_SUCCESS;
}
// The rest of the methods call the parent class,
// which performs default actions.
// IsEnabled, Help and About are yours. The default
// actions in the parent class are: "Yes, I'm enabled"
// and a big fat no-op for Help and About.
VAORC V$$safe_root$$::IsEnabled(LPVAOV2LSTRUCT pV2L)
{
return VAddon::IsEnabled(pV2L);
}
VAORC V$$safe_root$$::About(LPVAOV2LSTRUCT pV2L)
{
TCHAR szText[]= _T("$$root$$ Addon generated by MFC VAddon VSL Wizard.\n\nCopyright (c) 1997 by Visio Corporation.\nAll rights reserved.");
TCHAR szCaption[_MAX_PATH]= _T("About ");
_tcscat(szCaption, GetName());
MessageBox(GetActiveWindow(), szText, szCaption, MB_OK);
return VAORC_SUCCESS;
}
VAORC V$$safe_root$$::Help(LPVAOV2LSTRUCT pV2L)
{
TCHAR szText[]= _T("Code to jump to $$root$$'s help file is missing.");
TCHAR szCaption[_MAX_PATH]= _T("");
_tcscpy(szCaption, GetName());
_tcscat(szCaption, _T(" Help"));
MessageBox(GetActiveWindow(), szText, szCaption, MB_OK);
return VAORC_SUCCESS;
}
// You should always call VAddon::Load, Unload and
// KillSession and GetInstance or do the things that they
// do in your methods. See the source in "vaddon.cpp"
// and "vao.c" for more details.
VAORC V$$safe_root$$::Load(WORD wVersion, LPVOID p)
{
return VAddon::Load(wVersion, p);
}
VAORC V$$safe_root$$::Unload(WORD wParam, LPVOID p)
{
m_app= NULL;
return VAddon::Unload(wParam, p);
}
VAORC V$$safe_root$$::KillSession(LPVAOV2LSTRUCT pV2L)
{
return VAddon::KillSession(pV2L);
}
HINSTANCE V$$safe_root$$::GetInstance(long nFlags /*= 0L*/)
{
return VAddon::GetInstance(nFlags);
}
//*****************************************************************************
// V$$safe_root$$ convenience methods:
HRESULT V$$safe_root$$::GetApp(CVisioApplication &app)
{
if (m_app.IsSet() || VAO_SUCCESS==vaoGetObjectWrap(m_app))
{
app= m_app;
return NOERROR;
}
return E_FAIL;
}