winapi 读取二进制资源文件

 1 static char *get_resource(char *id, unsigned *size)
 2 {
 3     HRSRC hr = FindResource(GetModuleHandle(NULL), id, RT_RCDATA);
 4     
 5     if (hr == NULL) return NULL;
 6     *size = SizeofResource(GetModuleHandle(NULL), hr);
 7     h = LoadResource(GetModuleHandle(NULL), hr);
 8     return (char *)LockResource(h);
 9 }
10 
11 static void free_resource(void)
12 {
13     if (h)
14     {
15         FreeResource(h);
16         h = 0;
17     }
18 }
原文地址:https://www.cnblogs.com/ageane/p/winapi-res.html