Click here to Skip to main content
15,915,328 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Printing Output Pin
PJ Arends12-Dec-04 9:31
professionalPJ Arends12-Dec-04 9:31 
GeneralRe: Printing Output Pin
BRIMID12-Dec-04 14:01
BRIMID12-Dec-04 14:01 
Questionis this kind icon in an exe file possible? Pin
includeh1012-Dec-04 4:05
includeh1012-Dec-04 4:05 
AnswerRe: is this kind icon in an exe file possible? Pin
PJ Arends12-Dec-04 9:20
professionalPJ Arends12-Dec-04 9:20 
Generalras "error 632" Pin
mohsen nourian12-Dec-04 3:52
mohsen nourian12-Dec-04 3:52 
GeneralYahoo Messenger Pin
Member 141138912-Dec-04 3:08
Member 141138912-Dec-04 3:08 
GeneralBUG: ScrollWindowEx smoothscrolling, Child windows are drawn displaced Pin
Nalik12-Dec-04 2:03
Nalik12-Dec-04 2:03 
GeneralUpdateResource() ------ 2 Pin
includeh1012-Dec-04 0:49
includeh1012-Dec-04 0:49 
this is post i found in CodeGuru forum

1--------------------------------
Well, if the UpdateResource is not working for you, do this:
Open the file that contains the resource - CreateFile.
Create a file mapping of that file - CreateFileMapping.
Create a view of the file - MapViewOfFile.
Find the resource in the view using the pointer acquired in the previous step in place of HMODULE - FindResource.
Load the resource - LoadResource.
Lock the resource - LockResource.
Write the new resource to the address retrieved in the previous step. Make sure the new resource has the same size as the old one.
Unmap the view - UnmapViewOfFile.
Close file mapping - CloseHandle.
Close the file - CloseHandle.

2--------------------------------------
You have a new resource in memory. I trust you have the address of it, since you attempted to use UpdateResource.

The new resource is the same type and the same size as the one you are replacing. The size issue is very important. If it is larger, it may corrupt the file you are writing to. You can use SizeOfResource to verify.

Now, in previous steps you loaded a file into memory. In step 6 you recieved a pointer to the first byte of the resource you are about to replace. You can now use the function memcpy to copy the new resource into the memory occupied by the old resource. Calling UnmapViewOfFile wil save this change to the file.

One last thing. Check return values of every function you call for failure. Writing to an executable file is not something to be taken carelessly.

---------------------------------------------
it sounds terrible.
do u think the replies are reght?

any comments??

thx







includeh10
GeneralUpdateResource function Pin
includeh1012-Dec-04 0:29
includeh1012-Dec-04 0:29 
QuestionHow can I change focus between child windows within an MDI application Pin
wicked_guy12-Dec-04 0:16
wicked_guy12-Dec-04 0:16 
QuestionDid I miss something? Pin
jw8111-Dec-04 23:18
jw8111-Dec-04 23:18 
AnswerRe: Did I miss something? Pin
*Dreamz12-Dec-04 19:01
*Dreamz12-Dec-04 19:01 
GeneralRe: Did I miss something? Pin
jw8112-Dec-04 19:05
jw8112-Dec-04 19:05 
GeneralRe: Did I miss something? Pin
*Dreamz12-Dec-04 19:14
*Dreamz12-Dec-04 19:14 
GeneralRe: Did I miss something? Pin
jw8113-Dec-04 4:45
jw8113-Dec-04 4:45 
GeneralRe: Did I miss something? Pin
*Dreamz13-Dec-04 17:27
*Dreamz13-Dec-04 17:27 
GeneralC++ GameHook help Pin
RipeNades11-Dec-04 21:59
RipeNades11-Dec-04 21:59 
GeneraleMbedded Pin
su_penguin11-Dec-04 20:53
su_penguin11-Dec-04 20:53 
GeneralSingle MDI child Pin
sthaas11-Dec-04 19:58
sthaas11-Dec-04 19:58 
Generala little help... Pin
titanswimmer11-Dec-04 13:36
titanswimmer11-Dec-04 13:36 
GeneralRe: a little help... Pin
bob1697212-Dec-04 8:43
bob1697212-Dec-04 8:43 
Generalbitmap data Pin
includeh1011-Dec-04 12:40
includeh1011-Dec-04 12:40 
GeneralRe: bitmap data Pin
HalfWayMan12-Dec-04 1:31
HalfWayMan12-Dec-04 1:31 
GeneralRe: bitmap data Pin
includeh1012-Dec-04 2:11
includeh1012-Dec-04 2:11 
GeneralRe: bitmap data Pin
HalfWayMan12-Dec-04 2:33
HalfWayMan12-Dec-04 2:33 

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.