/** * @file XTPWinApp.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPWINAPP_H__) # define __XTPWINAPP_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" # ifndef _XTP_ACTIVEX # if defined(_XTP_USE_WINAPPEX) && (_MFC_VER >= 0x0900) # define CWinAppBase CWinAppEx # else # define CWinAppBase CWinApp # endif # else # define CWinAppBase COleControlModule # endif /** * @brief * All XTP application classes have to derive from CXTPWinApp instead of * CWinApp or CWinAppEx. This class handles XTP application initialization and resource cleanup. * @details In order to use CXTPWinApp derived from CWinAppEx ToolkitPro must be re-compiled with * _XTP_USE_WINAPPEX macro globally defined in compiler settings. _XTP_USE_WINAPPEX will also have * to be globally defined for the project that referencing Toolkit Pro. CXTPWinApp constructor * arguments change depending on _XTP_USE_WINAPPEX macro presense in order to allow pass arguments * to CWinAppEx class. */ class _XTP_EXT_CLASS CXTPWinApp : public CWinAppBase { DECLARE_DYNAMIC(CXTPWinApp); public: # ifndef _XTP_USE_WINAPPEX /** * @brief * Constructs CXTPWinApp object. * @param xtpComInit Global COM/OLE initialization method. xtpComInitAppDefault can be used for * default initialization method. * @details * If extended COM initialization flags are being used bu CoInitializeEx function is not * available then xtpComInitSTA is assumed, all other flags get ignored and the legacy * CoInitialize gets called. * @see * XTPComInit */ CXTPWinApp(int xtpComInit = xtpComInitAppDefault); # else /** * @brief * Constructs CXTPWinApp object. * @param bResourceSmartUpdate A Boolean parameter that specifies whether the workspace object * should detect and handle resource updates. * @param xtpComInit Global . can be used for * default initialization method. * @details * The default constructor uses xtpComInitAppDefault as a default COM/OLE initialization method, * and disables smart resource updating for CWinAppEx class, which corresponds its default * behavior. If extended COM initialization flags are being used bu CoInitializeEx function is * not available then xtpComInitSTA is assumed, all other flags get ignored and the legacy * CoInitialize gets called. * @see * XTPComInit */ CXTPWinApp(); /** * @brief * Constructs CXTPWinApp object. * @param bResourceSmartUpdate A Boolean parameter that specifies whether the workspace object * should detect and handle resource updates. * @param xtpComInit Global COM/OLE initialization method. xtpComInitAppDefault can be used for * default initialization method. * @details * If extended COM initialization flags are being used bu CoInitializeEx function is not * available then xtpComInitSTA is assumed, all other flags get ignored and the legacy * CoInitialize gets called. * @see * XTPComInit */ CXTPWinApp(BOOL bResourceSmartUpdate, int xtpComInit); # endif /** * @brief * Default destructor, handles cleanup / deallocation. */ virtual ~CXTPWinApp(); /** @cond */ //{{AFX_VIRTUAL(CXTPWinApp) virtual BOOL InitInstance(); virtual int ExitInstance(); //}}AFX_VIRTUAL /** @endcond */ protected: /** @cond */ //{{AFX_MSG(CXTPWinApp) //}}AFX_MSG DECLARE_MESSAGE_MAP() /** @endcond */ private: BOOL m_bXtpInitialized; BOOL m_bXtpUninitialized; }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPWINAPP_H__) /** @endcond */