Click here to Skip to main content
16,010,544 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Enumerating Catalogs using OLE DB Pin
Rashid Thadha20-Dec-01 6:48
Rashid Thadha20-Dec-01 6:48 
GeneralRe: Enumerating Catalogs using OLE DB Pin
PaulJ20-Dec-01 7:07
PaulJ20-Dec-01 7:07 
Questionhow to use LoadResource() Pin
Kuniva20-Dec-01 3:34
Kuniva20-Dec-01 3:34 
AnswerRe: how to use LoadResource() Pin
Pierre Heler-Caruel20-Dec-01 4:28
Pierre Heler-Caruel20-Dec-01 4:28 
Generali tried Pin
Kuniva20-Dec-01 8:00
Kuniva20-Dec-01 8:00 
GeneralRe: i tried Pin
Pierre Heler-Caruel20-Dec-01 20:51
Pierre Heler-Caruel20-Dec-01 20:51 
GeneralRe: i tried Pin
Kuniva21-Dec-01 2:53
Kuniva21-Dec-01 2:53 
GeneralRe: i tried Pin
Pierre Heler-Caruel21-Dec-01 4:18
Pierre Heler-Caruel21-Dec-01 4:18 
LockResource ... locks the resource, I think the names says it all Wink | ;) ...

Seriously, once you've locked the resource, you can manipulate it.

With the handle, you could do things like this to write it to a file (let's assume hYourApp is a Handle to your Application):

first retrieve its size

DWORD dwDataSize = SizeofResource((HMODULE)hYourApplication,ResInfo)
if(dwDataSize == 0)
{
// Failed to retrieve the Size
MessageBox("Ooops","Dear me...",MB_ICONEXCLAMATION);
return;
}

Then, you can create a file and dump the content of the Resource into it
FILE * pfResourceData = NULL,
BYTE * pData = NULL;

pfResourceData = fopen("SomeFileName","wb+");
if(pfResourceData)
{
if(! fwrite(pData,dwDataSize,1,pfResourceData))
{
fclose(Result);
DeleteFile("SomeFileName");
MessageBox("Failed to write Data",
"Oh Dear!",
MB_ICONEXCLAMATION);
return;
}
else
{
// Wrote all the Data so close the File
fclose(pfResourceData);
}
}

There you have it. The Resource Data should now be stored in "SomeFileName"

HTH

Cheers,

Pierre

P.S. I've used the "C" way of writing files to keep as generic as possible but of course you're free to use the
MFC way with CFile or File-handles, etc...
GeneralRe: i tried Pin
Kuniva21-Dec-01 6:16
Kuniva21-Dec-01 6:16 
AnswerRe: how to use LoadResource() Pin
Joaquín M López Muñoz20-Dec-01 4:28
Joaquín M López Muñoz20-Dec-01 4:28 
Answeri tried Pin
Kuniva20-Dec-01 6:20
Kuniva20-Dec-01 6:20 
AnswerRe: how to use LoadResource() Pin
Derek Waters20-Dec-01 11:02
Derek Waters20-Dec-01 11:02 
GeneralRe: how to use LoadResource() Pin
Kuniva21-Dec-01 2:53
Kuniva21-Dec-01 2:53 
GeneralRe: how to use LoadResource() Pin
Derek Waters1-Jan-02 10:48
Derek Waters1-Jan-02 10:48 
GeneralRe: how to use LoadResource() Pin
Kuniva2-Jan-02 5:04
Kuniva2-Jan-02 5:04 
Question"With" statement in MFC? Pin
User 665820-Dec-01 3:29
User 665820-Dec-01 3:29 
GeneralRe: "With" statement in MFC? Pin
User 665820-Dec-01 7:12
User 665820-Dec-01 7:12 
GeneralRe: "With" statement in MFC? Pin
Chris Losinger20-Dec-01 7:28
professionalChris Losinger20-Dec-01 7:28 
GeneralRe: "With" statement in MFC? Pin
User 665820-Dec-01 7:45
User 665820-Dec-01 7:45 
AnswerRe: "With" statement in MFC? Pin
Chris Losinger20-Dec-01 3:43
professionalChris Losinger20-Dec-01 3:43 
GeneralRe: "With" statement in MFC? Pin
Nemanja Trifunovic20-Dec-01 7:16
Nemanja Trifunovic20-Dec-01 7:16 
AnswerRe: "With" statement in MFC? Pin
Alvaro Mendez20-Dec-01 12:08
Alvaro Mendez20-Dec-01 12:08 
Generalproblem with delete Pin
Arjan Schouten20-Dec-01 3:15
Arjan Schouten20-Dec-01 3:15 
GeneralRe: problem with delete Pin
Chris Losinger20-Dec-01 3:19
professionalChris Losinger20-Dec-01 3:19 
GeneralRe: problem with delete Pin
Jon Hulatt21-Dec-01 0:08
Jon Hulatt21-Dec-01 0:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.