惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
博客园_首页
M
MIT News - Artificial intelligence
雷峰网
雷峰网
GbyAI
GbyAI
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
S
SegmentFault 最新的问题
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 【当耐特】
V
Visual Studio Blog
月光博客
月光博客
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
云风的 BLOG
云风的 BLOG
美团技术团队
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队

博客园 - 晨光静默

centos 命令 curl用到的一些命令 nginx记录 html select qq作文 mfc开启控制台打印日记 mfc右键菜单(包括系统托盘菜单)弹窗后如何消失 angular单页应用点击button自动刷新页面 setTimeout中调用angular的作用域生效 mfc模态对话框和非模态对话框注意点 c/c++元转分的bug c/c++中的崩溃代码片段 查看网络端口连接情况 win7x64安装python运行报错:api-ms-win-crt-runtime-|1-1-0.dll SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes qt导入头文件报错 python记录 (转)Curl命令详解 开箱即用的clogger 异步重叠IO linux xshell 命令上传下载文件
png转CBitmap
晨光静默 · 2022-10-21 · via 博客园 - 晨光静默

网络是个坑人的地方,需要实践!

// 加载bmp文件到CBitmap
bool LoadBmpPic(CString strBmpPath, CBitmap&bmp) { HBITMAP bitmap; try { bmp.Detach(); //从文件路径加载图片 bitmap = (HBITMAP)::LoadImage(NULL, strBmpPath, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE | LR_DEFAULTSIZE); if (bmp.Attach(bitmap)) { return true; } } catch (...) { AfxMessageBox("LoadBmpPic catch!"); return false; } return true; }
png转CBitmap:
void LoadPngImageToBmp(CString& path, CBitmap* bm) { CImage img; img.Load(path); #if 0 HBITMAP hbmp = (HBITMAP)img.operator HBITMAP(); bm->DeleteObject(); bm->Attach(hbmp); #elif 1 bm->Attach(img.Detach()); #else HBITMAP hBitmap; hBitmap = img.Detach(); bm->Attach(hBitmap); #endif }