版权所有 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;

}

最新文章

  1. Python标准模块--built-ins函数
  2. [转载]两个半小时学会Perl
  3. java写入文件的几种方法分享
  4. liunx下tomcat启动报错
  5. ParentWindow属性及其一系列函数的作用——适合于那些不需要父控件管理内存释放的子控件
  6. Eval()、XPath() 和 Bind() 这类数据绑定方法只能在数据绑定控件的上下文中使用
  7. JavaScript函数认识,Js中的常见函数
  8. javaFX的控制台实现
  9. 关于VB里判断逻辑的说明
  10. TiDB
  11. Frist one
  12. PHP不借助第三个变量交换值
  13. day 51 js-2 函数,对象,正则 (定时器示例)
  14. 使用 maven-assembly-plugin 打包项目
  15. 第8章 传输层(2)_UDP协议
  16. &#39;pip&#39; 不是内部或外部命令
  17. git基于历史commit创建分支
  18. css层叠样式优先级总结
  19. POJ-3009 Curling 2.0 (DFS)
  20. java模板

热门文章

  1. SVN提交碰到的问题奇怪的问题
  2. linux系统io的copy
  3. 新冲刺Sprint3(第一天)
  4. web安全之sql注入实例(5.0之前的)
  5. vim显示行数
  6. linux C 获取当前目录的实现(转-Blossom)
  7. UVa 679 小球下落
  8. Spring源码学习之:ClassLoader学习(1)
  9. 九度oj 题目1034:寻找大富翁
  10. [转]行者,一念一生,成功的背后!(给所有IT人)