Question

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 ;-)

Was it helpful?

Solution

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().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top