bool ExtractFileWithRes(unsigned int nResID, LPCTSTR pszResType, LPCTSTR pszSavePath)
{
if (NULL == pszResType || NULL == pszSavePath)
{
return false;
}
HRSRC hResource = FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(nResID), pszResType); // 查找目标资源
if (hResource != NULL)
{
// 加载资源
HGLOBAL hg = LoadResource(GetModuleHandle(NULL), hResource);
if (hg != NULL)
{
// 锁定资源
LPVOID pData = LockResource(hg);
if (pData != NULL)
{
// 获取资源大小
DWORD dwSize = SizeofResource(GetModuleHandle(NULL), hResource);
FILE *fp = fopen((const char *)(_bstr_t)pszSavePath, "wb");
if (fp != NULL)
{
DWORD dwCount = 0, dwWrite = 0;
while (dwCount < dwSize)
{
dwWrite