标记一下,原来如此简单,这下想办点什么坏事儿方便多了
BOOL ReleaseFile( LPCTSTR ResName, LPCTSTR ResType, LPCTSTR filename )
{
HRSRC hRes = ::FindResource( NULL, ResName, ResType );
HGLOBAL hGlobal =::LoadResource( NULL, hRes );
LPVOID ResBuffer = ::LockResource( hGlobal );
HANDLE fileHandle = ::CreateFile( filename, GENERIC_ALL, 0, NULL, CREATE_ALWAYS, 0, NULL);
if( fileHandle == INVALID_HANDLE_VALUE )
{
return FALSE;
}
DWORD Size;
if( !::WriteFile( fileHandle,ResBuffer, SizeofResource( NULL, hRes ), &Size, NULL ) )
{
return FALSE;
}
CloseHandle( fileHandle );
FreeResource( hGlobal );
return TRUE;
}
posted on 2009-01-13 17:14
ViskerWong 阅读(354)
评论(0) 编辑 收藏 引用 所属分类:
我的文章