將C++資源文件讀取出來

HRSRC   hResource   =   FindResource(GetModuleHandle(NULL),     
MAKEINTRESOURCE(IDR_CALC),   TEXT("MYFILE"));  
  if(hResource)  
  {   
      HGLOBAL   hg   =   LoadResource(GetModuleHandle(NULL),   hResource);  
      if(hg)  
      {  
            LPVOID   pData   =   LockResource(hg);  
           if(pData)  
           {  
                DWORD   dwSize   =   SizeofResource(GetModuleHandle(NULL),   hResource);  
                CFile   calcFile;  
                if(calcFile.Open("c://calc.exe",   CFile::modeCreate   |   CFile::modeReadWrite))  
                {  
                    calcFile.Write(pData,   dwSize);  
                    calcFile.Close();   
                }   
            }  
       }  
  }  it

相關文章
相關標籤/搜索