[GDI+] GdiPlus在dll中的初始化位置
来源:互联网 发布:手机淘宝6.2.0官方版 编辑:程序博客网 时间:2024/06/06 05:38
GDI+的初始化和反初始化 是调用GdiplusStartup 和 GdiplusShutdown
如果dll中使用了GDI+,GDI+的初始化应该放在哪里?可以放在DllMain()中吗?
按照MSDN的说法 这种情况下 常用以下方法进行初始化:
1、在应用层中调用GdiplusStartup 和 GdiplusShutdown
2、dll导出API, 在API中执行GdiplusStartup 和 GdiplusShutdown,由应用层调用API进行初始化和反初始化
3、dll里所有会调用GDI+的函数中,都执行一次GdiplusStartup 和 GdiplusShutdown (这个方法应该没人会采用···)
详见MSDN: https://msdn.microsoft.com/en-us/library/ms534077(VS.85).aspx
附一段我常用的自动初始化GDI+的代码(注意头文件包含的顺序,否则有链接错误)
#include <Windows.h> // must be inluded before gdiplus.h, otherwise compile error #include <gdiplus.h>#pragma comment(lib, "gdiplus.lib")class CAutoLoadGDIPlus{ ULONG_PTR m_GdiplusToken;public: CAutoLoadGDIPlus() { Gdiplus::GdiplusStartupInput StartupInput; GdiplusStartup(&m_GdiplusToken, &StartupInput, NULL); } ~CAutoLoadGDIPlus() { // 注意: 卸载前必须清理所有GDI+的对象 因为卸载后再清理会有异常 Gdiplus::GdiplusShutdown(m_GdiplusToken); }}g_GdiplusInstance;
1 0
- [GDI+] GdiPlus在dll中的初始化位置
- Gdi+在MFC中的初始化
- GDI在VS2005中的初始化
- GDIPLUS环境初始化以及与GDI结合实现双缓冲
- MFC DLL初始化位置
- DLL中GDIPlus初始化和退出时注意的问题
- gdi gdiplus directx
- GDI+ GDIPlus 的配置
- GDI+ gdiplus!CreateDashedPath漏洞分析
- gdiplus Bitmap 转 gdi BITMAP
- gdi/gdiplus如何加载字体
- 调用gdiplus.dll 异常 (无法加载 DLL (gdiplus.dll))
- Mono System.DllNotFoundException: gdiplus.dll
- GDI+初始化
- GDI+初始化
- GDI+初始化
- GDI+初始化
- 初始化GDI+
- 5位数字黑洞
- 深入剖析Java中的装箱和拆箱
- pthread_mutex_t的使用
- Block写法
- react native windows开发环境搭建
- [GDI+] GdiPlus在dll中的初始化位置
- 2016最新iOS视频 小马哥十一期OC/Swift/HTML5/React Native视频
- BootStrap学习与实践(一)
- cocoapod安装,第三方库的安装与删除
- scala学习笔记之安装
- source insight 阅读源码,注释为乱码解决方案
- 第四届蓝桥杯C++A组——颠倒的价牌
- python3+PyQt5 图形项的自定义和交互--实现page Designer应用程序
- R语言编程练习【1】