// XMessageBox.cpp Version 1.10
//
// Author: Hans Dietrich
// hdietrich@gmail.com
//
// Description:
// XMessageBox.cpp implements XMessageBox(), a drop-in replacement for
// MessageBox() that includes custom checkboxes, custom buttons, custom
// icon, and more. For more information see
// http://www.codeproject.com/KB/dialog/xmessagebox.aspx
//
// History
// Version 1.10 - 2008 November 29
// - Fixed problem with XMESSAGEBOX_DO_NOT_SAVE_CHECKBOX
//
// Version 1.9 - 2008 November 22
// - Fixed keyboard processing broken in 1.8
//
// Version 1.8 - 2008 November 19
// - Added new bit flag VistaStyle to XMSGBOXPARAMS::dwOptions.
// Setting this option bit will cause the message background to be
// painted with the current window color (typically white), and the
// buttons to be right-justified.
// - Added new bit flag Narrow to XMSGBOXPARAMS::dwOptions.
// Setting this option bit will cause the message box to be no wider
// than SM_CXSCREEN / 3.
// - Added two new members to XMSGBOXPARAMS: crText and crBackground,
// allowing you to specify the message text and background colors.
// - Made all buttons auto-size, depending on button text. Buttons will
// have the usual width, unless the text is too long to fit.
// - Eliminated requirement that you define all the user-defined button
// strings, even if you just wanted to change a few strings. All the
// button strings that you do <u>not</u> specify will have their default
// value.
// - Fixed centering problem when checkbox is specified
// - Replaced checkbox width calculation with one based on DLUs
// - Added function XMessageBoxGetCheckBox() to check if a checkbox value
// has been stored in registry or ini file
// - Added countdown indicator to caption when disabled timer is used
// - Added an internal message loop.
//
// Version 1.7 - 2008 November 9
// - Converted button sizes to dialog units, suggested by Brian
// - Made custom buttons auto-size (depending on text), suggested by Albert Weinert
//
// Version 1.6 - 2008 November 6
// - Added Ctrl-C feature
// - Mods for 64-bit support, provided by wilfridc
// - Added VS2005 project
// - Fixed problem with Vista and NONCLIENTMETRICS struct
// - Fixed bug with using resource id for caption
//
// Version 1.5 - 2006 August 21
// - Fixed bugs reported by kingworm, TMS_73, Curtis Faith, ladislav Hruska,
// Tim Hodgson, DrJohnAir
// - Incorporated Uwe Keim's changes for dynamic button captions
//
// Version 1.4 - 2003 December 10
// - Implemented MB_DONOTSHOWAGAIN
// - Implemented MB_TOPMOST
// - Implemented MB_SETFOREGROUND
// - Added MB_SKIPSKIPALLCANCEL and MB_IGNOREIGNOREALLCANCEL, suggested
// by Shane L
// - Added HINSTANCE parameter for loading strings from extra-exe resource
// - Added "report function" parameter for optional report function
// - Added custom button parameter to allow definition of custom buttons,
// thanks to Obliterator for comments and review
// - Added timeout parameter to automatically select default button
// after timeout expires, thanks to Obliterator for suggestion
// - Added disabled time parameter, that will disable all buttons on the
// messagebox for n seconds (for nag dialogs).
// - Added custom icon parameter
// - The XMessageBox dialog will now be centered even in non-MFC apps,
// thanks to Tom Wright for suggestion
// - The message text and caption text can now be passed as either a string
// or a resource ID (using MAKEINTRESOURCE)
// - The initial x,y screen coordinates can now be specified.
// - The buttons can now be centered (default) or right-justified, as
// in XP Explorer.
// - Response to "Do Not Ask/Tell" checkboxes will be saved automatically
// to ini file, if lpszModule member is non-NULL
// - Gathered all optional parameters into one optional XMSGBOXPARAMS struct.
// - Added assert if default button is set to Help or Report button
// - Removed statics and rearranged code into classes, thanks to code from
// Anne Jan Beeks
//
// Version 1.3 - 2001 July 31
// - Miscellaneous improvements and bug fixes
//
// Version 1.2 - 2001 July 13
// - Initial public release
//
// Some parts of this software are from information in the Microsoft SDK.
//
// This software is released into the public domain. You are free to use it
// in any way you like, except that you may not sell this source code.
//
// This software is provided "as is" with no expressed or implied warranty.
// I accept no liability for any damage or loss of business that this software
// may cause.
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// include the following line if compiling an MFC app
#include "stdafx.h"
///////////////////////////////////////////////////////////////////////////////
#ifndef _MFC_VER
#include <windows.h>
#include <stdio.h>
#include <crtdbg.h>
#include <tchar.h>
#pragma message(" compiling for Win32")
#else
#pragma message(" compiling for MFC")
#endif
#include "XMessageBox.h"
#pragma warning(disable : 4127) // conditional expression is constant
#pragma warning(disable : 4996) // disable bogus deprecation warning
#define countof(array) (sizeof(array)/sizeof(array[0]))
#ifndef __noop
#if _MSC_VER < 1300
#define __noop ((void)0)
#endif
#endif
#undef TRACE
#define TRACE __noop
//=============================================================================
// if you want to see the TRACE output, uncomment this line:
//#include "XTrace.h"
//=============================================================================
///////////////////////////////////////////////////////////////////////////////
//
// If you want to save the state of "Do Not Ask/Tell" checkbox to profile (ini)
// file instead of registry, uncomment the following line:
//
//#define XMESSAGEBOX_USE_PROFILE_FILE
///////////////////////////////////////////////////////////////////////////////
//
// If you do not want automatic saving of "Do Not Ask/Tell" checkbox,
// uncomment the following line:
//
//#define XMESSAGEBOX_DO_NOT_SAVE_CHECKBOX
///////////////////////////////////////////////////////////////////////////////
//
// If you have chosen to automatically save "Do Not Ask/Tell" checkbox to ini:
//
// Normally the lpszModule and nLine data are encoded, since it might not be
// desirable to allow users to be able to see the path and module name of
// your source file. If you do not want encoding of "Do Not Ask/Tell" module
// info in the registry (or ini file), uncomment the following line:
//
//#define XMESSAGEBOX_DO_NOT_ENCODE
///////////////////////////////////////////////////////////////////////////////
//
// This identifier specifies the format of the text displayed for the timeout
// key, which by default is "%s = %d". You may change this to anything you
// wish, as long as 1) there is both a %s and a %d; and 2) the %s precedes
// the %d.
//
#define XMESSAGEBOX_TIMEOUT_TEXT_FORMAT _T("%s = %d")
///////////////////////////////////////////////////////////////////////////////
//
// This identifier specifies the name of the ini file, which by default
// is "XMessageBox.ini".
//
#define XMESSAGEBOX_INI_FILE _T("XMessageBox.ini")
///////////////////////////////////////////////////////////////////////////////
//
// This identifier specifies the registry key used to store checkbox values.
// By default it is "XMessageBox".
//
#define XMESSAGEBOX_REGIST
danxuezx
- 粉丝: 274
- 资源: 82
最新资源
- 各种排序算法java实现的源代码.zip
- 金山PDF教育版编辑器
- 基于springboot+element的校园服务平台源代码项目包含全套技术资料.zip
- 自动化应用驱动的容器弹性管理平台解决方案
- 各种排序算法 Python 实现的源代码
- BlurAdmin 是一款使用 AngularJs + Bootstrap实现的单页管理端模版,视觉冲击极强的管理后台,各种动画效果
- 基于JSP+Servlet的网上书店系统源代码项目包含全套技术资料.zip
- GGJGJGJGGDGGDGG
- 基于SpringBoot的毕业设计选题系统源代码项目包含全套技术资料.zip
- Springboot + mybatis-plus + layui 实现的博客系统源代码全套技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈