FindResource () RT_HTML 为什么总是出错呢 ?
#include <windows.h> #include <commdlg.h> #include <ole2.h> BOOL GetHtmlResource(LPCSTR pszName, /*out*/PBYTE& pb, /*out*/DWORD& cb) { // Find specified resource and check if ok HRSRC hrsrc = ::FindResource(NULL, "default", MAKEINTRESOURCE(RT_HTML)); if(!hrsrc) return false; // Load specified resource and check if ok HGLOBAL hgres = ::LoadResource(NULL, hrsrc); if(!hgres) return FALSE; // Retrieve resource data and check if ok pb = (PBYTE)::LockResource(hgres); if (!pb) return FALSE; cb = ::SizeofResource(NULL, hrsrc); if (!cb) return FALSE; return TRUE; } int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd ) { PBYTE pb; DWORD cb; GetHtmlResource("default",pb,cb); return 0; }
findResult 总是 返回0x000000蛋疼的很!