note : Release program embedded resource
发布日期:2021-06-30 22:04:30 浏览次数:2 分类:技术文章

本文共 1469 字,大约阅读时间需要 4 分钟。

// ReleaseEmbeddedResource.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include 
#include
#include
#include "resource.h"/// Release program embedded resourceBOOL ExtractBinResource(const WCHAR * pcResName, int iResourceId, const WCHAR * pcOutputFullPathName);int _tmain(int argc, _TCHAR* argv[]){ /// usage BOOL bRc = ExtractBinResource(L"BIN", IDR_BIN_ZIP_FILE, L"c:\\windows\\temp\\test.zip"); return 0;}BOOL ExtractBinResource(const WCHAR * pcResName, int iResourceId, const WCHAR * pcOutputFullPathName){ BOOL bRc = FALSE; HGLOBAL hResourceLoaded; // handle to loaded resource HRSRC hRes; // handle/ptr. to res. info. char * pcResLock; // pointer to resource data DWORD dwSizeRes; // find location of the resource and get handle to it hRes = FindResource(NULL, MAKEINTRESOURCE(iResourceId), pcResName); if (NULL != hRes) { // loads the specified resource into global memory. hResourceLoaded = LoadResource(NULL, hRes); // get a pointer to the loaded resource! pcResLock = (char *)LockResource(hResourceLoaded); // determine the size of the resource, so we know how much to write out to file! dwSizeRes = SizeofResource(NULL, hRes); /// 保证文件夹已经被创建 /// function write binary content to file // bRc = WriteToFile(pcOutputFullPathName, (UCHAR *)pcResLock, dwSizeRes, TRUE); } return bRc;}

转载地址:https://lostspeed.blog.csdn.net/article/details/19136855 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:note : DuiDesigner 添加的 WebBrowser 网页被打开后不能控制网页行为
下一篇:(转)将DuiLib编译成静态库

发表评论

最新留言

很好
[***.229.124.182]2024年04月07日 18时13分32秒