Click here to Skip to main content
15,891,033 members
Articles / Desktop Programming / MFC

WWhizInterface: Enhancements to the Visual C++ Automation Interface

Rate me:
Please Sign up or sign in to vote.
4.50/5 (5 votes)
28 Jul 2001 149.9K   2.6K   47  
A C++ interface with a number of Visual C++ automation enhancements, allowing for more robust add-in programming.
///////////////////////////////////////////////////////////////////////////////
// $Workfile: TemplateWizardDialog.h $
// $Archive: /WorkspaceWhiz/Src/WorkspaceWhiz/TemplateWizardDialog.h $
// $Date:: 1/03/01 12:13a  $ $Revision:: 12   $ $Author: Jjensen $
///////////////////////////////////////////////////////////////////////////////
// This source file is part of the Workspace Whiz! source distribution and
// is Copyright 1997-2001 by Joshua C. Jensen.  (http://workspacewhiz.com/)
//
// The code presented in this file may be freely used and modified for all
// non-commercial and commercial purposes so long as due credit is given and
// this header is left intact.
///////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_TEMPLATEWIZARDDIALOG_H__D5BAEAA2_662B_11D3_9B27_A0D222CC8952__INCLUDED_)
#define AFX_TEMPLATEWIZARDDIALOG_H__D5BAEAA2_662B_11D3_9B27_A0D222CC8952__INCLUDED_

#pragma once
// TemplateWizardDialog.h : header file
//

#if _MSC_VER < 1200
#include <ExDisp.h>
#endif //_MSC_VER

/////////////////////////////////////////////////////////////////////////////
// CTemplateWizardDialog dialog

interface IWebBrowser2;

#define TEMPLATE_WIZARD_DIALOG CHtmlHelpDialog

class CTemplateWizardDialog : public TEMPLATE_WIZARD_DIALOG
{
// Construction
	DECLARE_EVENTSINK_MAP()
public:
	CTemplateWizardDialog(WWhizTemplate& code, CWnd* pParent = NULL);   // standard constructor
	~CTemplateWizardDialog();

	bool SetCustomPage(const CString& page, bool nextOn, bool previousOn, bool finishOn);
	CString m_lastButtonHit;

// Dialog Data
	//{{AFX_DATA(CTemplateWizardDialog)
	enum { IDD = IDD_TEMPLATEWIZARD };
	CButton	m_butCancel;
	CButton	m_previousButton;
	CButton	m_nextButton;
	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTemplateWizardDialog)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	CWnd m_wndBrowser;
	IWebBrowser2* m_pBrowserApp;

	bool m_nextOn;
	bool m_previousOn;
	bool m_finishOn;

	MemFile m_htmlFile;
	WWhizTemplate& m_code;
	CString m_page;
	int m_curPage;

	CMapStringToString m_params;
	CString m_asciiFilename;

	void GreyButtons();
	void Render();
	void UpdateFromHtml();
	void WriteString(LPCTSTR str);

	virtual void DocumentComplete(LPDISPATCH pDisp, VARIANT* URL);

	// Generated message map functions
	//{{AFX_MSG(CTemplateWizardDialog)
	afx_msg void OnTwNext();
	afx_msg void OnTwPrevious();
	virtual void OnOK();
	virtual BOOL OnInitDialog();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	virtual void OnCancel();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/**
**/
class WWhizTemplateDialogImpl : public WWhizTemplateDialog
{
public:
	virtual CString Run(WWhizTemplate& code, const CString& page, bool nextOn,
			bool previousOn, bool finishOn)
	{
		CTemplateWizardDialog dlg(code);
		dlg.SetCustomPage(page, nextOn, previousOn, finishOn);
		dlg.DoModal();

		return dlg.m_lastButtonHit;		
	}
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TEMPLATEWIZARDDIALOG_H__D5BAEAA2_662B_11D3_9B27_A0D222CC8952__INCLUDED_)

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
Joshua Jensen is a gamer at heart and as such, creates games for a living. He has the distinct pleasure of creating titles exclusively for the Xbox.

In his spare time, he maintains a Visual C++ add-in called Workspace Whiz! Find it at http://workspacewhiz.com/.

Comments and Discussions