ProXicT
ProXicT

Reputation: 1933

Change text file on runtime in resource.rc winapi c++

I would like to read from file in resource file. That's ok like so:

char LineBuffer[255]; HRSRC hRes = FindResource(0, MAKEINTRESOURCE(ID_TEXT_FILE), "0"); if(hRes != NULL) { HGLOBAL hData = LoadResource(0, hRes); if(hData != NULL) { sprintf(LineBuffer, "%s", LockResource(hData)); } }

But I want to change the text in the txt file stored in resource. I have read something about it and everyone uses BeginUpdateResource(); UpdateResource(); EndUpdateResource(); but I don't get it. Any help would be appreciated :) A code snippet would be awesome. Thanks in advance ;-)

Upvotes: 0

Views: 943

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 595295

A running process cannot alter its own resources. You have to use a separate application to update the resources of the main application while it is not running. Only then can you use (Begin/End)UpdateResource().

Upvotes: 1

Related Questions