版权所有 2009-2015 荆门泽优软件有限公司
保留所有权利
产品首页:http://www.ncmem.com/apps/xproerui/index.asp
开发文档(SkinStudio):为图片添加九宫格信息,为窗体设置背景图片,添加图片按钮,共用字体属性,控件的相对位置与绝对位置
升级日志:http://www.cnblogs.com/xproer/archive/2010/12/04/1896399.html
资源下载(360云盘):boost-1.55.0-src(提取码:9d60),boost-1.55.0-lib(VC100)(提取码:ef58),zlib-1.2.8-src(提取码:6ebe),pugxml-1.4-src(提取码:4858),CxImage-src(提取码:4e39),
资源下载(百度网盘):boost-1.55.0-src,boost-1.55.0-lib,zlib-1.2.8-src,pugxml-1.4-src,CxImage-src,
资源下载-WTL(360云盘):XproerUI库(提取码 61ca),XproerUI开发文档(提取码 85f1),
资源下载-MFC(360云盘):XproerUI库(提取码 a25a),XproerUI开发文档(提取码 06ba),
联系邮箱:1085617561@qq.com
联系QQ:1085617561
项目类型:WTL
主要步骤如下:
1.下载库头文件和库lib文件。
2.在项目中配置库头文件路径和链接器文件路径。
XproerUI结构:
3rd 第三方库目录
cximage
dll 编译的DLL目录
pugixml-1.4
lib 编译的LIB目录
zlib-
dll 编译的DLL目录
XproerUI UI引擎库目录
dll 编译的DLL目录
Resource
Xproer.Com
Xproer.Drawing
Xproer.Forms
Xproer.Manager
Xproer.UI
Xproer.UI.Controls
Xproer.UI.WinControls
1.1.1. 下载相关资源
boost-
boost-
zlib-
zlib-
pugxml-1.4-src:360云盘(提取码 4858),百度网盘,
pugxml-1.4-lib(VC100):360云盘(提取码 ce29),
CxImage-src:360云盘(提取码 4e39),
CxImage-dll(VC100):360云盘(提取码 4785),
WTL80-src:360云盘(提取码 8989),
WTL81_12085-src:360云盘(提取码 09e1),
WTL90_4140_Final-src:360云盘(提取码 dd76),
XproerUI:360云盘(提取码 61ca),百度网盘,
1.1.2. 设置头文件路径和链接库路径
说明:建议将项目文件夹和XproerUI放在同级目录下
示例结构:
3rd 第三方库目录
AppUI XproerUI库目录
AppUtils Xproer工具库目录
demo 自已的工程目录
使用上面的目录结构可以直接使用下面的头文件和链接库配置代码(在Debug和Release模式下通用):
头文件:
.
..3rdpugixml-1.4src
..3rdcximageCxImage
..3rdzlib-1.2.8
..AppUtils
合并:
.;..3rdpugixml-1.4src;..3rdcximageCxImage;..3rdzlib-1.2.8;..AppUtils;
链接库(MD):
..3rdpugixml-1.4lib$(ConfigurationName)
..3rdcximagedllUnicode $(ConfigurationName)
..3rdzlib-1.2.8dll$(ConfigurationName)
..AppUtils
%(AdditionalLibraryDirectories)
合并:
..3rdpugixml-1.4lib$(ConfigurationName);..3rdcximagedllUnicode $(ConfigurationName);..3rdzlib-1.2.8dll$(ConfigurationName);..AppUtilsdll$(ConfigurationName);%(AdditionalLibraryDirectories)
附加包含目录截图:
链接器配置截图:
1.1.3. 在项目的stdafx.h中增加头文件
XproerUI提供了UIHead.h文件,在项目中只需要包含此文件即可。
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
// Change these values to use different versions
#define WINVER 0x0500
#define _WIN32_WINNT 0x0501
#define _WIN32_IE 0x0501
#define _RICHEDIT_VER 0x0500
//包含UIHead.h文件
#include "UIHead.h"
extern CAppModule _Module;
#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='
#elif defined _M_IA64
#pragma comment(linker, "/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='
#elif defined _M_X64
#pragma comment(linker, "/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='
#else
#pragma comment(linker, "/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='
#endif
说明:在UIHead.h中自动包含了boost,AppUtils,XproerUI.lib,zlib,cximage,pugixml等文件和lib
UIHead.h文件代码如下:
#pragma warning(disable:4150) //
#pragma warning(disable:4251) //
#pragma warning(disable:4275) //
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#define _WTL_NO_CSTRING
#define _WTL_NO_WTYPES
#include <atlbase.h>
#include <atlstr.h>
#include <atltypes.h>
#include <atlapp.h>
#include <atlctrls.h>
#include <atlcrack.h>
#include <atldlgs.h>
#include <atlframe.h>
#include <atlwin.h>
#include <atlmisc.h>
#include <atlcom.h>
#include <atlctl.h>
#include "atltime.h"
#include <atlhost.h>
#include <GdiPlus.h>
#include "Richole.h"
#include "Richedit.h"
#include "shellapi.h"
#include "Usp10.h"
using namespace Gdiplus;
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <memory>
#include <fstream>
#include <string>
#include <functional>
using namespace std;
#include <boost/foreach.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/any.hpp>
#include <boost/variant.hpp>
#include <boost/bimap.hpp>
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/assert.hpp>
#include <boost/assign.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pool/detail/singleton.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#define BOOST_ALL_NO_LIB
#define BOOST_DATE_TIME_SOURCE
#define foreach BOOST_FOREACH
#define reverse_foreach BOOST_REVERSE_FOREACH
using namespace boost;
using namespace boost::assign;
using namespace boost::gregorian;
using namespace boost::posix_time;
using namespace boost::filesystem;
namespace fs = boost::filesystem;
using boost::details::pool::singleton_default;
#include "ximage.h"
#include "sigslot.h"
#include "pugiconfig.hpp"
#include "pugixml.hpp"
#include "contrib/minizip/zip.h"
#include "contrib/minizip/unzip.h"
using namespace pugi;
#include "sigslot.h"
#include "AppUICfg.h"
#include "AppUtilsCfg.h"
#include "Resource/IResource.h"
#include "Xproer.Drawing/GdiTool.h"
#include "Xproer.Drawing/CxImageTool.h"
#include "Xproer.Drawing/CombinImage.h"
#include "Xproer.Drawing/CombinImageX.h"
#include "Xproer.Drawing/TileImage.h"
#include "Xproer.Drawing/TileImageX.h"
#include "xproer.Manager/ResMgr.h"
#include "Xproer.Manager/ColorMgr.h"
#include "xproer.Manager/FontMgr.h"
#include "xproer.Manager/ImageMgr.h"
#include "xproer.Manager/PopMenuMgr.h"
#include "Xproer.Manager/StyleManager.h"
#include "xproer.Manager/ImageCfg.h"
#include "Xproer.UI/ArgsManager.h"
#include "Xproer.UI/Styles.h"
#include "Xproer.UI/IDSigner.h"
#include "Xproer.UI/DUIControl.h"
#include "Xproer.UI/AppUI.h"
#include "Utility/Encoder.h"
#include "Utility/Convert.h"
#include "IO/Directory.h"
#include "System/Screen.h"
using namespace Xproer::Manager;
using namespace Xproer::UI;
using namespace Xproer::System;
using namespace Xproer::Drawing;
using namespace AppUtils::Utility;
#pragma comment(lib, "Usp10.lib")
#pragma comment(lib, "cximage.lib")
#pragma comment(lib, "gdiplus.lib")
#pragma comment(lib, "pugixml.lib")
#pragma comment(lib, "zlib.lib")
#pragma comment(lib, "AppUtils.lib")
#pragma comment(lib, "XproerUI.lib")
#ifdef _DEBUG
#pragma comment(lib, "libboost_date_time-vc100-mt-1_55.lib")
#pragma comment(lib, "libboost_system-vc100-mt-gd-1_55.lib")
#pragma comment(lib, "libboost_filesystem-vc100-mt-gd-1_55.lib")
#else
#pragma comment(lib, "libboost_date_time-vc100-mt-1_55.lib")
#pragma comment(lib, "libboost_system-vc100-mt-1_55.lib")
#pragma comment(lib, "libboost_filesystem-vc100-mt-1_55.lib")
#endif
2.将项目运行库改为MD
修改Release模式的运行库:
1.1.4. 在_tWinMain中初始化UI库
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
//加载RichEditor.dll
HRESULT hRes = ::CoInitialize(NULL);
HMODULE hMod = ::LoadLibrary(CRichEditCtrl::GetLibraryName());
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0,
//初始化GDI+
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
AtlAxWinInit();
//初始化UI库
LoadTheme(L"Theme.skn");
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
//卸载UI库
UnLoadTheme();;
//卸载GDI+
GdiplusShutdown(gdiplusToken);
//释放CRichEdit动态链接库
if(NULL != hMod) ::FreeLibrary(hMod);
::CoUninitialize();
return nRet;
}
1.1.5. 修改主窗口代码
1.继承DialogBase,将将消息转发给DialogBase处理
// MainDlg.h : interface of the CMainDlg class
//
#pragma once
#include "xproer.Forms/DialogBase.h"
using namespace Xproer::Forms;
class CMainDlg
: public CAxDialogImpl<CMainDlg>
, public DialogBase
{
public:
enum { IDD = IDD_MAINDLG };
BEGIN_MSG_MAP(CMainDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
COMMAND_ID_HANDLER(IDOK, OnOK)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
CHAIN_MSG_MAP(DialogBase)//转发消息
END_MSG_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
2.在OnInitDialog中设置关联的配置文件
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
this->AttachDlg(this->m_hWnd, L"360yunpan.xml");//设置关联的界面信息
CenterWindow();
// set icons
HICON hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON));
SetIcon(hIcon, TRUE);
HICON hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
SetIcon(hIconSmall, FALSE);
return TRUE;
}