/***********************************************************************/ /* Copyright (C) 2002 Definitive Solutions, Inc. All Rights Reserved. */ /* THIS COMPUTER PROGRAM IS PROPRIETARY AND CONFIDENTIAL TO DEFINITIVE */ /* SOLUTIONS, INC. AND ITS LICENSORS AND CONTAINS TRADE SECRETS OF */ /* DEFINITIVE SOLUTIONS, INC. THAT ARE PROVIDED PURSUANT TO A WRITTEN */ /* AGREEMENT CONTAINING RESTRICTIONS ON USE AND DISCLOSURE. ANY USE, */ /* REPRODUCTION, OR TRANSFER EXCEPT AS PROVIDED IN SUCH AGREEMENT */ /* IS STRICTLY PROHIBITED. */ /***********************************************************************/ ///////////////////////////////////////////////////////////////////////////// // How to add this class to your application. // // Add MyMessageBox.cpp, MyMessageBox.h, MyMessageBoxResource.h, and // MyMessageBox.rc2 to your project in the usual folders. // // Add this line to the top of your RC2 file: // #include "MyMessageBoxResource.h" // MyMessageBox resources. // // Add this line to the end of your RC2 file: // #include "MyMessageBox.rc2" // MyMessageBox resources. // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MYMESSAGEBOX_H__D61021C0_869B_11D2_BFEA_444553540000__INCLUDED_) #define AFX_MYMESSAGEBOX_H__D61021C0_869B_11D2_BFEA_444553540000__INCLUDED_ #pragma once #include "MyStatic.h" #include "MyButton.h" #include "MyDialog.h" #include "MyEdit.h" #include "MyMessageBoxResource.h" ///////////////////////////////////////////////////////////////////////////// // To support the "Always" checkbox, we have to store the boolean in the // Registry under the caller's __FILE__, __LINE__, and version. These macros // implement that. If you don't need this functionality, just use one of the // constructors that don't support "Always". // Your calling code must define this variable for this class in "stdafx.h". // For example: #define MYMESSAGEBOX_VERSION_ "4.0.0.0" #ifndef MYMESSAGEBOX_VERSION_ #error MYMESSAGEBOX_VERSION_ must be defined! #endif // Your calling code must define this variable for this class in "stdafx.h". // For example: #define MYMESSAGEBOX_REGPLACEMENTSKEY_ "Software\\YourCompany\\YourApp\\Placements" #ifndef MYMESSAGEBOX_REGPLACEMENTSKEY_ #error MYMESSAGEBOX_REGPLACEMENTSKEY_ must be defined! #endif // Your calling code must define this variable for this class in "stdafx.h". // For example: #define MYMESSAGEBOX_REGALWAYSKEY_ "Software\\YourCompany\\YourApp\\MyMessageBoxAlways" #ifndef MYMESSAGEBOX_REGALWAYSKEY_ #error MYMESSAGEBOX_REGALWAYSKEY_ must be defined! #endif // Use these macro just to make it easier to call the "Always"-enabled // constructor. #define MyMessageBoxAlways1(Text, uiHeadline) \ MyMessageBox box(Text, __FILE__, __LINE__, this, uiHeadline) #define MyMessageBoxAlways2(Text, uiHeadline, uiStyle) \ MyMessageBox box(Text, __FILE__, __LINE__, this, uiHeadline, uiStyle) #define MyMessageBoxAlways3(Text, uiHeadline, uiStyle, uiDetailsID) \ MyMessageBox box(Text, __FILE__, __LINE__, this, uiHeadline, uiStyle, uiDetailsID) ///////////////////////////////////////////////////////////////////////////// // MyMessageBox dialog // Declare the class depending on this file is in an EXE project or a DLL one. class #ifdef _WINDLL AFX_EXT_CLASS #endif MyMessageBox : public MyDialog { // Construction. public: // These two constructors do NOT support the "Always" checkbox. MyMessageBox(UINT uiText, CWnd* pParent = NULL, UINT uiHeadline = 0U, UINT uiStyle = MB_OK, UINT uiDetailsID = 0U); MyMessageBox(const CString& sText, CWnd* pParent = NULL, UINT uiHeadline = 0U, UINT uiStyle = MB_OK, UINT uiDetailsID = 0U); // These two constructors DO support the "Always" checkbox. MyMessageBox(UINT uiText, const CString& sFile, int nLine, CWnd* pParent = NULL, UINT uiHeadline = 0U, UINT uiStyle = MB_OK, UINT uiDetailsID = 0U); MyMessageBox(const CString& sText, const CString& sFile, int nLine, CWnd* pParent = NULL, UINT uiHeadline = 0U, UINT uiStyle = MB_OK, UINT uiDetailsID = 0U); // ClassWizard hates it when you have AFX_DATA_INIT in more than one place! void CommonConstruct(); //{{AFX_DATA(MyMessageBox) enum { IDD = IDD_MYMESSAGEBOX }; MyEdit m_editText; CButton m_buttonCancel; CButton m_buttonOk; MyButton m_buttonDetails; MyStatic m_staticHeadline; CButton m_checkAlways; CString m_sText; BOOL m_bAlways; //}}AFX_DATA //{{AFX_VIRTUAL(MyMessageBox) protected: virtual void DoDataExchange(CDataExchange* pDX); virtual void OnOK(); //}}AFX_VIRTUAL // Overrides. public: virtual int DoModal(); // Implementation. protected: //{{AFX_MSG(MyMessageBox) virtual BOOL OnInitDialog(); afx_msg void OnButtonDetails(); //}}AFX_MSG DECLARE_MESSAGE_MAP() // Data. private: UINT m_uiText; // String table id of message. UINT m_uiHeadline; // String table id of headline. UINT m_uiDetailsID; // String table id of details. UINT m_uiStyle; // Message format values. const CString m_sFile; // __FILE__ for "Always" mode only. int m_nLine; // __LINE__ for "Always" mode only. }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MYMESSAGEBOX_H__D61021C0_869B_11D2_BFEA_444553540000__INCLUDED_)