怎样读取资源文件中的文件

    技术2022-05-12  8

    // 将鼠标文件释放到临时文件中以便读取 HRSRC hResource = FindResource(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_ANI_AIM), _T("ANI_CURSOR")); if(hResource) { HGLOBAL hg = LoadResource(GetModuleHandle(NULL), hResource); if(hg) { LPVOID pData = LockResource(hg); if(pData) { DWORD dwSize = SizeofResource(GetModuleHandle(NULL), hResource); CFile IconFile; TCHAR strTmpPath[MAX_PATH]; TCHAR strTmpFle[MAX_PATH]; if (GetTempPath(MAX_PATH, strTmpPath) && GetTempFileName(strTmpPath, _T("MASTER"), 0, strTmpFle) && IconFile.Open(strTmpFle, CFile::modeWrite | CFile::modeCreate)) { IconFile.Write(pData, dwSize); IconFile.Close(); m_strTmpCursorFileName = strTmpFle; } } } }


    最新回复(0)