刚学,请帮忙把这个程序改成一个直接能编译的,谢谢
HRSRC hMyRes;
HGLOBAL hgpt;
LPVOID lpBuff;
DWORD rcSize=13312;
HANDLE hFile;
LPDWORD dwByte;
dwByte=&rcSize;
hMyRes=FindResource((HMODULE)GetWindowLong(NULL,GWL_HINSTANCE),MAKEINTRESOURCE(IDR_OUTLOOK),"Outlook");
if (hMyRes==NULL)
{
AfxMessageBox(GetLastError());
}
hgpt=LoadResource(NULL,hMyRes);
if (hgpt==NULL)
{
AfxMessageBox(GetLastError());
}
lpBuff=LockResource(hgpt);
hFile=CreateFile("e:\\Test.exe",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
WriteFile(hFile,lpBuff,rcSize,dwByte,NULL);
if (*dwByte!=13312)
{
AfxMessageBox("写文件失败!");
}
else
{
AfxMessageBox("生成文件成功!");
}
CloseHandle(hFile);