Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

The Ultimate Toolbox - Updates and User Contributions

, 12 Feb 2013
Updates and User Contributions for the Ultimate Toolbox Libraries
OutlookDemoUpdate.zip
Ultimate Grid
Demos
OutlookStyle
OutlookStyle.aps
OutlookStyle.dsp
OutlookStyle.dsw
OutlookStyle.suo
res
bitmap1.bmp
bmattach.bmp
bmp00001.bmp
bmp00002.bmp
bmp00003.bmp
Flags.bmp
OutlookStyle.ico
OutlookStyleDoc.ico
Toolbar.bmp
toolbar1.bmp
toolbar2.bmp
toolbarf.bmp
UltimateGrid72_Src_Update01.zip
CellTypes
Include
Source
UltimateGrid72_Src_Update02.zip
DataSources
ODBC
OleDB
EditControls
UltimateGrid72_Src_Update03.zip
UltimateGrid72_Src_Update04.zip
UltimateGrid73_src.zip
BuildDLL
Build DLL.dsp
Build DLL.dsw
res
BuildLib
ugmfclib.dsp
ugmfclib.dsw
Lib
Skel
UltimateTCP-IP42_Src_Update01.zip
Ultimate TCP-IP
Include
Security
Include
Source
source
UltimateTCP-IP42_Src_Update02.zip
Examples
Client
Mail
icon1.ico
icon2.ico
MailClientS.suo
test.dsp
test.dsw
UltimateTCP-IP42_Src_Update03.zip
ultimatetoolbox93_src_update01.zip
Ultimate Toolbox
include
source
UltimateToolbox93_Src_Update02.zip
lib
Build DLLs
Build Libs
UltimateToolbox93_Src_Update03.zip
UltimateToolbox93_Src_Update04.zip
UltimateToolbox93_Src_Update05.zip
// ==========================================================================
//			Class Implementation: COXCustomizePage
// ==========================================================================

// Version: 9.3

// This software along with its related components, documentation and files ("The Libraries")
// is � 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is
// governed by a software license agreement ("Agreement").  Copies of the Agreement are
// available at The Code Project (www.codeproject.com), as part of the package you downloaded
// to obtain this file, or directly from our office.  For a copy of the license governing
// this software, you may contact us at legalaffairs@codeproject.com, or by calling 416-849-8900.
                         
// //////////////////////////////////////////////////////////////////////////


#include "stdafx.h"

// v93 update 03 - 64-bit
#include "UTB64Bit.h"

#include "OXCustomizePage.h"
#include "OXCustomizeManager.h"

#ifndef __OXMFCIMPL_H__
#if _MFC_VER < 0x0700
	#include <..\src\afximpl.h>
#else
	#include <..\src\mfc\afximpl.h>
#endif
#define __OXMFCIMPL_H__
#endif


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


const int IDC_DEFAULTPAGE=1000;


IMPLEMENT_DYNCREATE(COXCustomizePage, CWnd)

/////////////////////////////////////////////////////////////////////////////
// COXCustomizePage

COXCustomizePage::COXCustomizePage() :
	m_nDialogID(0xffffffff),
	m_pCustomizeManager(NULL),
	m_sProfileName(_T("")),
	m_bInitialized(FALSE)
{
#ifndef _AFX_NO_OCC_SUPPORT
	m_pOccDialogInfo = NULL;
#endif
}

COXCustomizePage::~COXCustomizePage()
{
}


BEGIN_MESSAGE_MAP(COXCustomizePage, CWnd)
	//{{AFX_MSG_MAP(COXCustomizePage)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// COXCustomizePage message handlers

// virtual override of CWnd::Create
BOOL COXCustomizePage::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd, CRect rect, 
							  UINT nID, DWORD dwStyle/*=WS_VISIBLE|WS_CHILD*/)
{
	ASSERT(pParentWnd!=NULL);
	ASSERT(lpszTemplateName!=NULL);

	// initialize common controls
	VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG));

	BOOL bShowWindow=((dwStyle&WS_VISIBLE)==WS_VISIBLE);
	dwStyle&=~WS_VISIBLE;

	// call PreCreateWindow to get prefered extended style
	CREATESTRUCT cs={ 0 };
	cs.style=dwStyle;
	if(!PreCreateWindow(cs))
		return FALSE;

	// create a modeless dialog
	if(!CreateDlg(lpszTemplateName, pParentWnd))
		return FALSE;

	// we use the style from the template - but make sure that
	//  the WS_BORDER bit is correct
	// the WS_BORDER bit will be whatever is in dwRequestedStyle
	ModifyStyle(WS_BORDER|WS_CAPTION,(cs.style&~(WS_BORDER|WS_CAPTION))|WS_CHILD);
	ModifyStyleEx(WS_EX_CLIENTEDGE,(cs.dwExStyle&~WS_EX_CLIENTEDGE));

	SetDlgCtrlID(nID);

	// initialize controls etc
	if(!ExecuteDlgInit(lpszTemplateName))
		return FALSE;

	// give the page an opportunity to initialize its contents
	OnInitDialog();

	// force the size requested
	SetWindowPos(NULL, rect.left, rect.top,
		rect.right - rect.left, rect.bottom - rect.top,
		SWP_NOZORDER|SWP_NOACTIVATE);

	// make visible if requested
	if(bShowWindow)
		ShowWindow(SW_NORMAL);

	return TRUE;
}


BOOL COXCustomizePage::Load(const COXCustomizeManager* pCustomizeManager)
{
	ASSERT(m_nDialogID!=0xffffffff);
	ASSERT(pCustomizeManager!=NULL);
	ASSERT(m_pCustomizeManager==NULL || m_pCustomizeManager==pCustomizeManager);

	if(::IsWindow(GetSafeHwnd()))
	{
		ASSERT(m_pCustomizeManager==pCustomizeManager);
		ShowWindow(SW_SHOW);
		return TRUE;
	}
	else
	{
		m_pCustomizeManager=(COXCustomizeManager*)pCustomizeManager;

		if(!Create(MAKEINTRESOURCE(m_nDialogID),m_pCustomizeManager->GetSite(),
			CRect(0,0,0,0),IDC_DEFAULTPAGE))
		{
			m_pCustomizeManager=NULL;
			return FALSE;
		}

		return TRUE;
	}
}

void COXCustomizePage::Unload()
{
	if(::IsWindow(GetSafeHwnd()))
	{
		ShowWindow(SW_HIDE);
	}
}


void COXCustomizePage::OnDestroy() 
{
	// TODO: Add your message handler code here
	if(m_LayoutManager.IsAttached())
		m_LayoutManager.Detach();

	m_bInitialized=FALSE;

	CWnd::OnDestroy();
}


BOOL COXCustomizePage::PreTranslateMessage(MSG* pMsg)
{
	ASSERT(pMsg!=NULL);
	ASSERT_VALID(this);

	// allow tooltip messages to be filtered
	if(CWnd::PreTranslateMessage(pMsg))
		return TRUE;

	// don't translate dialog messages when in Shift+F1 help mode
	CFrameWnd* pFrameWnd=GetTopLevelFrame();
	if(pFrameWnd!=NULL && pFrameWnd->m_bHelpMode)
		return FALSE;

	// since 'IsDialogMessage' will eat frame window accelerators,
	// we call all frame windows' PreTranslateMessage first
	pFrameWnd=GetParentFrame();   // start with first parent frame
	while(pFrameWnd!=NULL)
	{
		// allow owner & frames to translate before IsDialogMessage does
		if(pFrameWnd->PreTranslateMessage(pMsg))
			return TRUE;

		// try parent frames until there are no parent frames
		pFrameWnd=pFrameWnd->GetParentFrame();
	}

	// don't call IsDialogMessage if demo is empty
	if(::GetWindow(GetSafeHwnd(),GW_CHILD)==NULL)
		return FALSE;

	// filter both messages to demo children
	return PreTranslateInput(pMsg);
}


BOOL COXCustomizePage::SaveWorkspaceState()
{
	return TRUE; 
}

#ifndef _AFX_NO_OCC_SUPPORT
BOOL COXCustomizePage::SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo)
{
	m_pOccDialogInfo = pOccDialogInfo;
	return TRUE;
}
#endif //!_AFX_NO_OCC_SUPPORT

BOOL COXCustomizePage::OnCmdMsg( UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo )
{
#ifdef OX_CUSTOMPAGE_KEYSOKCANCEL
	if (nID==IDCANCEL || nID==IDOK)
		return m_pCustomizeManager->OnCmdMsg(nID, nCode, pExtra,pHandlerInfo);
	else
#endif
		return CWnd::OnCmdMsg(nID, nCode, pExtra,pHandlerInfo);
}


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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

The Ultimate Toolbox
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.
 
Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
Group type: Organisation

381 members


| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 13 Feb 2013
Article Copyright 2008 by The Ultimate Toolbox
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid