如何使用XproerUI库(WTL)-XproerUI界面库教程
版权所有 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-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-src:官网,360云盘(提取码 9d60),百度网盘,
boost-1.55.0-lib(VC100):360云盘(提取码 ef58),百度网盘,
zlib-1.2.8-src:360云盘(提取码 6ebe),百度网盘,
zlib-1.2.8-dll(VC100) :360云盘(提取码 25c3),百度网盘,
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模式下通用):
头文件:
.\
..\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 : 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='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#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, 0L);
//初始化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;
}
如何使用XproerUI库(WTL)-XproerUI界面库教程的更多相关文章
- UILite-MFC/WTL/DirectUI界面库
之前写了UILite库介绍: http://blog.csdn.net/zhangzq86/article/details/9093945 如今UILite库能够使用git訪问了: https://g ...
- 几款国产开源的Windows界面库
上次介绍的几款图形界面库http://blog.okbase.net/vchelp/archive/23.html都是国外的开源项目,今天介绍的几款都是国人的开源项目,大部分是采用DirectUI设计 ...
- C++界面库
刚开始用C++做界面的时候,根本不知道怎么用简陋的MFC控件做出比较美观的界面,后来就开始逐渐接触到BCG Xtreme ToolkitPro v15.0.1,Skin++,等界面库,以及一些网友自 ...
- 开源.NET界面库
一.十大开源的.NET用户界面框架 选择一款合适的GUI框架是.NET开发中比较重要但又很棘手的问题,因为用户界面相当于一款应用的"门面",直接面向用户.好的UI更能吸引用户,有时 ...
- C++界面库(十几种,很全)
刚开始用C++做界面的时候,根本不知道怎么用简陋的MFC控件做出比较美观的界面,后来就开始逐渐接触到BCG Xtreme ToolkitPro v15.0.1,Skin++,等界面库,以及一些网友自 ...
- C++100款开源界面库[转]
(声明:Alberl以后说到开源库,一般都是指著名的.或者不著名但维护至少3年以上的.那些把代码一扔就没下文的,Alberl不称之为开源库,只称为开源代码.这里并不是贬低,像Alberl前面那个系列的 ...
- C++ 100款开源界面库 (10)
(声明:Alberl以后说到开源库,一般都是指著名的.或者不著名但维护至少3年以上的.那些把代码一扔就没下文的,Alberl不称之为开源库,只称为开源代码.这里并不是贬低,像Alberl前面那个系列的 ...
- 仿迅雷播放器教程 -- C++ 100款开源界面库 (10)
(声明:Alberl以后说到开源库,一般都是指著名的.或者不著名但维护至少3年以上的.那些把代码一扔就没下文的,Alberl不称之为开源库,只称为开源代码.这里并不是贬低,像Alberl前面那个系 ...
- 仿迅雷播放器教程 -- C++ windows界面库对比(11)
从上一篇文章中可以看出,C++的界面方向还很弱,没有任何一个界面库可以一统天下,所以才造成了界面库百家争鸣的情况. 从时间上看: 1.出来最早的是QT,1991年就有了. 2.VC++ 虽然1992年 ...
随机推荐
- 不同vlan之间的相互访问
拓扑图: 用到的命令: 给端口的vlan <sw1>用户模式 切换到系统模式 system-view 交换机名称 sysname swj1 创建vlan 3 端口模式选择int g0/0/ ...
- ubuntu 调整桌面图标大小
打开文件浏览器,例如从“位置” 里打开 “主文件夹”,点 “编辑” –>“首选项”,把 “图标视图默认值” 下的“默认缩放级别” 改为 75%.现在图标大小跟WinXP 下的差不多. 或者 在 ...
- sed命令的基本使用
sed(Stream Editor):流编辑器 一次只读取一行 模式空间 1.sed语法: sed [option] "script" FILE... 2.选项: -n:静默模式, ...
- js 函数和变量的提升
js 函数和变量的提升 1. 函数的作用域: js中 ,函数的作用域为函数,而不是大括号. var hei = 123;if(true){ hei = 456;}console.log(hei);// ...
- 02_java语法基础_课程动手动脑问题以及课后实验性问题及解答集锦
Answer: 动手动脑: 1:1.1--仔细阅读实例:EnumTest.java,运行它,分析运行结果? 1.2--你能得到什么结论?你掌握了枚举变量的基本用法了吗? answer:枚举类型是引用类 ...
- Linux之Qt利用Sqlite静态编译库(转)
参考:http://www.linuxidc.com/Linux/2011-11/47465.htm sqlite3编译安装 ------------------------arm版--------- ...
- js中的this指针(二)
在 js 中声明并定义一个函数后,除了定义时传入的形式参数,函数还会接收到 2 个附加的参数:this 和 arguments. this 指针的值取决于调用时的模式. 当这个函数被保存为对象的一个属 ...
- Nginx 负载均衡学习
nginx作为负载均衡服务器,用户请求先到达nginx,再由nginx根据负载配置将请求转发至 tomcat服务器. nginx负载均衡服务器 tomcat1服务器 tomcat2服务器 1.1 ...
- CentOS 7 php留言本网站的搭建
一如既往的先搭建yum仓库 并且安装httpd服务 yum install httpd -y 1:改网页的搭建是基于html搭建 查询是否安装该协议 rpm -qa |grep httpd 2:留言板 ...
- express创建项目
sudo apt-get install node-express-generator dave@voctrals:~/WebstormProjects/nodejs-study/express$ e ...