项目类型:MFC

 
XproerUI结构:
3rd                    第三方库目录
  cximage
    dll                编译的DLL目录
  pugixml-1.4         
    lib                编译的LIB目录
  zlib-1.2.8
    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-1.55.0-lib(VC100):360云盘(提取码 ef58),百度网盘,
 
1.1.2.    设置头文件路径和链接库路径
说明:建议将项目文件夹和XproerUI放在同级目录下
示例结构:
3rd           第三方库目录
AppUI         XproerUI库目录
AppUtils      Xproer工具库目录
demo          自已的工程目录
 
使用上面的目录结构可以直接使用下面的头文件和链接库配置代码(在Debug和Release模式下通用):
头文件:
.\
..\3rd\pugixml-1.4\src
..\3rd\cximage\CxImage
..\3rd\zlib-1.2.8
..\AppUtils
合并:
.\;..\3rd\pugixml-1.4\src;..\3rd\cximage\CxImage;..\3rd\zlib-1.2.8;..\AppUtils;
 
链接库(MD):
..\3rd\pugixml-1.4\lib\$(ConfigurationName)\
..\3rd\cximage\dll\Unicode $(ConfigurationName)\
..\3rd\zlib-1.2.8\dll\$(ConfigurationName)\
..\AppUtils\
%(AdditionalLibraryDirectories)
合并:
..\3rd\pugixml-1.4\lib\$(ConfigurationName)\;..\3rd\cximage\dll\Unicode $(ConfigurationName)\;..\3rd\zlib-1.2.8\dll\$(ConfigurationName)\;..\AppUtils\dll\$(ConfigurationName)\;%(AdditionalLibraryDirectories)
 
附加包含目录截图:
 
链接器配置截图:
 
1.1.3.    在项目的stdafx.h中增加头文件
XproerUI提供了UIHead.h文件,在项目中只需要包含此文件即可。
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
 
#pragmaonce
 
#ifndefVC_EXTRALEAN
#defineVC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
#endif
 
#include"targetver.h"
 
#define_ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
 
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
#define_AFX_ALL_WARNINGS
 
#include<afxwin.h>         // MFC 核心组件和标准组件
#include<afxext.h>         // MFC 扩展
 
 
#include<afxdisp.h>        // MFC 自动化类
 
 
 
#ifndef _AFX_NO_OLE_SUPPORT
#include<afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include<afxcmn.h>             // MFC 对 Windows 公共控件的支持
#endif// _AFX_NO_AFXCMN_SUPPORT
 
#include<afxcontrolbars.h>     // 功能区和控件条的 MFC 支持
 
#include"UIHead.h"
 
#ifdef_UNICODE
#ifdefined _M_IX86
#pragmacomment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elifdefined _M_X64
#pragmacomment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragmacomment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
说明:在UIHead.h中自动包含了boost,AppUtils,XproerUI.lib,zlib,cximage,pugixml等文件和lib
UIHead.h文件代码如下:
#pragmawarning(disable:4150) //
#pragmawarning(disable:4251) //
#pragmawarning(disable:4275) //
 
#include"afxtoolbar.h"
#include"afxmenubar.h"
#include"afxtoolbarmenubutton.h"
#include<gdiplus.h>
#include"Richole.h"
#include"Richedit.h"
#include"shellapi.h"
#include"Usp10.h"
#include<ctime>
usingnamespaceGdiplus;
 
#include"atlutil.h"
 
#include<vector>
#include<list>
#include<map>
#include<algorithm>
#include<fstream>
#include<iostream>
#include<string>
#include<array>
#include<memory>
usingnamespacestd;
 
#include<boost/foreach.hpp>
#include<boost/typeof/typeof.hpp>
#include<boost/shared_array.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/random.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>
#defineBOOST_ALL_NO_LIB
#defineBOOST_DATE_TIME_SOURCE
#defineforeachBOOST_FOREACH
#definereverse_foreachBOOST_REVERSE_FOREACH
usingnamespaceboost;
usingnamespaceboost::assign;
usingnamespaceboost::gregorian;
usingnamespaceboost::posix_time;
usingnamespaceboost::filesystem;
namespacefs = boost::filesystem;
usingboost::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"
usingnamespacepugi;
 
#include"sigslot.h"
#include"AppUI.h"
#include"AppUICfg.h"
#include"AppUtilsCfg.h"
#include"Resource/IResource.h"
#include"Xproer.Drawing/GdiTool.h"
#include"ximage.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.Drawing/MemoryDC.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.Manager/ToolBarMgr.h"
#include"Xproer.Forms/DialogBase.h"
#include"Xproer.UI/ArgsManager.h"
#include"Xproer.UI/Styles.h"
#include"Xproer.UI/IDSigner.h"
#include"Xproer.UI/CtrlIDMaker.h"
#include"Xproer.UI/DUIControl.h"
#include"Xproer.UI.Controls/Button.h"
#include"Utility/Encoder.h"
#include"Utility/Convert.h"
#include"IO/Directory.h"
#include"System/Screen.h"
usingnamespaceXproer::Manager;
usingnamespaceXproer::System;
usingnamespaceXproer::Drawing;
usingnamespaceXproer::UI;
usingnamespaceXproer::UI::Controls;
usingnamespaceXproer::Forms;
usingnamespaceAppUtils::Utility;
usingnamespaceAppUtils::IO;
 
#pragmacomment(lib, "Usp10.lib")
#pragmacomment(lib, "cximage.lib")
#pragmacomment(lib, "gdiplus.lib")
#pragmacomment(lib, "pugixml.lib")
#pragmacomment(lib, "zlib.lib")
#pragmacomment(lib, "AppUtils.lib")
#pragmacomment(lib, "XproerUI.lib")
#ifdef_DEBUG 
#pragmacomment(lib, "libboost_date_time-vc100-mt-1_55.lib")
#pragmacomment(lib, "libboost_system-vc100-mt-gd-1_55.lib")
#pragmacomment(lib, "libboost_filesystem-vc100-mt-gd-1_55.lib")
#else
#pragmacomment(lib, "libboost_date_time-vc100-mt-1_55.lib")
#pragmacomment(lib, "libboost_system-vc100-mt-1_55.lib")
#pragmacomment(lib, "libboost_filesystem-vc100-mt-1_55.lib")
#endif
 
2.将项目运行库改为MD
 
修改Release模式的运行库:
 
1.1.4.    在InitInstance中初始化UI库
BOOLCmfcDemoApp::InitInstance()
{
     // 如果一个运行在 Windows XP 上的应用程序清单指定要
     // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
     //则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
     INITCOMMONCONTROLSEXInitCtrls;
     InitCtrls.dwSize = sizeof(InitCtrls);
     // 将它设置为包括所有要在应用程序中使用的
     // 公共控件类。
     InitCtrls.dwICC = ICC_WIN95_CLASSES;
     InitCommonControlsEx(&InitCtrls);
 
     CWinApp::InitInstance();
 
 
     AfxEnableControlContainer();
 
     // 创建 shell 管理器,以防对话框包含
     // 任何 shell 树视图控件或 shell 列表视图控件。
     CShellManager *pShellManager = newCShellManager;
 
     // 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
     CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
 
     // 标准初始化
     // 如果未使用这些功能并希望减小
     // 最终可执行文件的大小,则应移除下列
     // 不需要的特定初始化例程
     // 更改用于存储设置的注册表项
     // TODO:  应适当修改该字符串,
     // 例如修改为公司或组织名
     SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
     GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
     //初始化UI库
     LoadAppTheme(L"skin.zip");//skin.zip需要和主程序放在一起
 
     CmfcDemoDlgdlg;
     m_pMainWnd = &dlg;
     INT_PTRnResponse = dlg.DoModal();
     if (nResponse == IDOK)
     {
     }
     elseif (nResponse == IDCANCEL)
     {
     }
     elseif (nResponse == -1)
     {
         TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
         TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
     }
 
     // 删除上面创建的 shell 管理器。
     if (pShellManager != NULL)
     {
         deletepShellManager;
     }
 
     returnFALSE;
}
 
在应用程序退出时卸载皮肤和GDI+
intCmfcDemoApp::ExitInstance()
{
     UnLoadTheme();
     //卸载GDI+
     GdiplusShutdown(gdiplusToken);
 
     returnCWinApp::ExitInstance();
}
 
1.1.5.    修改主窗口代码
1.继承FormMsgHandler
#pragmaonce
 
// CmfcDemoDlg 对话框
classCmfcDemoDlg
     : publicCDialogEx
     , publicFormMsgHandler
{
// 构造
public:
     CmfcDemoDlg(CWnd* pParent = NULL);   // 标准构造函数
 
     virtualLRESULTWindowProc(UINTmessage, WPARAMwParam, LPARAMlParam);
 
     //dui
     virtualvoidInitControls();
 
     //event
     voidbtnCancle_click(ControlBase* sender);
 
private:
     Button* m_btnCancel;//退出按钮
 
// 对话框数据
     enum { IDD = IDD_MFCDEMO_DIALOG };
 
     protected:
     virtualvoidDoDataExchange(CDataExchange* pDX);   // DDX/DDV 支持
 
 
// 实现
protected:
     HICONm_hIcon;
 
     // 生成的消息映射函数
     virtualBOOLOnInitDialog();
     afx_msgvoidOnSysCommand(UINTnID, LPARAMlParam);
     afx_msgHCURSOROnQueryDragIcon();
     DECLARE_MESSAGE_MAP()
};
 
2.重载WindowProc方法,将消息转发到UI引擎
LRESULTCmfcDemoDlg::WindowProc(UINTmessage, WPARAMwParam, LPARAMlParam)
{
     BOOLhd = FALSE;
     if (this->isWmMsg(message))
     {
         returnthis->wmMsgMap(message, wParam, lParam,hd);
     }
     returnCDialogEx::WindowProc(message, wParam, lParam);
}
 
3.在OnInitDialog中初始化UI资源
BOOLCmfcDemoDlg::OnInitDialog()
{
     CDialogEx::OnInitDialog();
 
     // 将“关于...”菜单项添加到系统菜单中。
 
     // IDM_ABOUTBOX 必须在系统命令范围内。
     ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
     ASSERT(IDM_ABOUTBOX < 0xF000);
 
     CMenu* pSysMenu = GetSystemMenu(FALSE);
     if (pSysMenu != NULL)
     {
         BOOLbNameValid;
         CStringstrAboutMenu;
         bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
         ASSERT(bNameValid);
         if (!strAboutMenu.IsEmpty())
         {
              pSysMenu->AppendMenu(MF_SEPARATOR);
              pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
         }
     }
 
     // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
     //  执行此操作
     SetIcon(m_hIcon, TRUE);          // 设置大图标
     SetIcon(m_hIcon, FALSE);         // 设置小图标
 
     // 加载UI资源
     this->init(this, L"demo.xml");
 
     returnTRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
 
4.在InitControls中获取控件并与成员变量关联
voidCmfcDemoDlg::InitControls()
{
     this->m_btnCancel = (Button*)this->find(L"button2");
     this->m_btnCancel->Click.connect(this, &CmfcDemoDlg::btnCancle_click);
}
 
5.编写控件事件
voidCmfcDemoDlg::btnCancle_click(ControlBase* sender)
{
     TRACE("btnCancle_click \n");
     this->EndDialog(1);
}

1.1. 如何使用XproerUI库的更多相关文章

  1. 如何使用XproerUI库(WTL)-XproerUI界面库教程

    版权所有 2009-2015 荆门泽优软件有限公司 保留所有权利 产品首页:http://www.ncmem.com/apps/xproerui/index.asp 开发文档(SkinStudio): ...

  2. 新建一个UI窗口-XproerUI(MFC)教程

    版权所有 2009-2015 荆门泽优软件有限公司 保留所有权利 产品首页:http://www.ncmem.com/apps/xproerui/index.asp 在线文档(XproerUI):Xp ...

  3. 如何在属性面板中增加一个属性-UI界面编辑器(XproerUI)教程

    版权所有 2009-2015 荆门泽优软件有限公司 保留所有权利 产品首页:http://www.ncmem.com/apps/xproerui/index.asp 开发文档(SkinStudio): ...

  4. XproerIM V2开源,基于XproerUI引擎构架

    资源下载:XproerIM源代码(访问密码:2e47),imServer(访问密码 364c), 技术交流群:6259765 技术支持:3040217208 咨询邮箱:2190615607@qq.co ...

  5. 菜鸟Python学习笔记第一天:关于一些函数库的使用

    2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...

  6. TinyWeb v1.0 正式完成第一个Release版本(功能基于 libuv 跨平台库)

    使用方法很简单,很容易融入现有项目,使现有项目拥有Web网站功能和WebSocket,以及Socket直连! 并且包含了一个跨平台(windows/linux)工具集合; 嗯,也挺棒的^,^ 在项目中 ...

  7. 在 Laravel 中使用图片处理库 Integration/Image

    系统需求 PHP >= 5.3 Fileinfo Extension GD Library (>=2.0) … or … Imagick PHP extension (>=6.5.7 ...

  8. [APUE]标准IO库(下)

    一.标准IO的效率 对比以下四个程序的用户CPU.系统CPU与时钟时间对比 程序1:系统IO 程序2:标准IO getc版本 程序3:标准IO fgets版本 结果: [注:该表截取自APUE,上表中 ...

  9. [APUE]标准IO库(上)

    一.流和FILE对象 系统IO都是针对文件描述符,当打开一个文件时,即返回一个文件描述符,然后用该文件描述符来进行下面的操作,而对于标准IO库,它们的操作则是围绕流(stream)进行的. 当打开一个 ...

随机推荐

  1. 1001. 害死人不偿命的(3n+1)猜想 (15)

    1001. 害死人不偿命的(3n+1)猜想 (15) 较简单,直接代码实现: #include <cstdio> int main() { int n; scanf("%d&qu ...

  2. git学习:多人协作,标签管理

    多人协作: 查看远程库的信息, git remote 推送分支到远程库 git push origin master/dev 注意:master是主分支,时刻需要与远程同步 dev是开发分支,也需要与 ...

  3. 带无缝滚动的轮播图(含JS运动框架)

    今天学习了一下轮播图的写作,想到前一阵学过的无缝滚动得思想,所以就把轮播与滚动结合了一下.不过我的代码的神逻辑我自己都不敢恭维,在没网没参照的情况下,只能硬着头皮往下写,希望跟大家共勉吧. js运动框 ...

  4. 函数指针_typedef

    一 函数指针 1 函数类型 函数的类型由它的返回值类型,和形参类型共通过决定,与函数名无关. eg:bool lengthcompare(const string&, const string ...

  5. oleDB 导入excel遇到的问题

    本地测试一切ok. 到服务器上测试各种报错,先装了office2010,又装了AccessDatabaseEngine,之后报"Microsoft Excel 不能访问文件 可能的原因有: ...

  6. VC++6.0 配置CppUTest测试环境

    最近看<软件项目成功之道>,书中无数次提及到“单元测试”对于项目成败的重要性,看到同事将CppUTest用于Linux动态库测试,于是在VC++6.0环境下搭建一个基于CppUTest的单 ...

  7. org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/pcisv7]]

    重新配jar包

  8. AX7: Quick and easy debugging

    This purpose of this blog is to show how you can get quickly get started with debuggingin AX7, speci ...

  9. Unable to install breakpoint in

    Unable to install breakpoint inXXXX due to missing line number attributes.modify compiler options to ...

  10. jq 版的tab切换

    ta切换是在前端中非常常见的一种效果,网上的效果很多.但是我觉得下面这种方法最好,把tab效果封装成一个函数 tabs,这个函数要配合jq使用. var tabs = function (tab, c ...