Why post this here????? You should post it on the Windows board....
Anyway, you should be able to import custom resources........you can with VC++.......
For example;
[list=1][*]Insert->Resource->Custom[*]Call it "FILE"[*]Insert->Resource->Import[*]Select a file and select "FILE" as its type[*]The IDE gives the resource a name like "IDR_FILE2" (in my case)[/list=1]
Then type the following code;
Code:
#include <windows.h>
#include "resource.h"
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR lpszArgs, int nWinMode)
{
HRSRC hRes;
HGLOBAL hGlobRes;
LPBYTE lpData = 0;
HANDLE hFile;
DWORD dwSize,dwWritten;
hRes = FindResource(NULL,MAKEINTRESOURCE(IDR_FILE2),"FILE");
if(hRes == NULL){
MessageBox(HWND_DESKTOP,"Could not find resource","Error",
MB_OK | MB_ICONEXCLAMATION);
return 1;
}
hGlobRes = LoadResource(NULL,hRes);
if(hGlobRes == NULL){
MessageBox(HWND_DESKTOP,"Could not load resource","Error",
MB_OK | MB_ICONEXCLAMATION);
return 1;
}
lpData = (LPBYTE)LockResource(hGlobRes);
if(lpData == NULL){
MessageBox(HWND_DESKTOP,"Could not lock resource","Error",
MB_OK | MB_ICONEXCLAMATION);
return 1;
}
dwSize = SizeofResource(NULL,hRes);
hFile = CreateFile("MyFile.zip",GENERIC_WRITE,0,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile == INVALID_HANDLE_VALUE){
MessageBox(HWND_DESKTOP,"Could not create file","Error",
MB_OK | MB_ICONEXCLAMATION);
return 1;
}
if(!WriteFile(hFile,lpData,dwSize,&dwWritten,NULL)){
MessageBox(HWND_DESKTOP,"Could not write to file","Error",
MB_OK | MB_ICONEXCLAMATION);
return 1;
}
MessageBox(HWND_DESKTOP,"File Extracted!","Success",MB_OK);
return 0;
}
That will extract your file (a zipfile in my case).......
Would a kind Moderator please move this to the proper forum.