PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Application Updating Its Resources?

Can a Pocket PC application update its own resources using BeginUpdateResource, UpdateResource, and EndUpdateResource APIs as described here:

Using Resources

What I experience, is that the call to BeginUpdateResource fails. Is this because the application is running? I can't really tell because GetLastError returns 0.

Is it possible for an application to update its resources? How?
I might be wrong, but I seem to remember having read that you can't update resources on PPC. But then you have to wonder why the API is there. Mmm.
I'm remembering the same thing as Thierry... I think in the one instance it came up for me, I had to copy the resource before I could modify it at all. Let us know if you find out differently though...
What I don't like is that the API documentation isn't very specific about when you can update a resource and when you can't. It just says this:


If the function succeeds, the return value is a handle that can be used by the UpdateResource and EndUpdateResource functions. The return value is NULL if the specified file is not an executable file, the executable file is already loaded, the file does not exist, or the file cannot be opened for writing. To get extended error information, call GetLastError.


So I assume it's failing because the running application is "already loaded." However, I can't get any extended error information from GetLastError, so I don't know for sure.
How well do memory mapped files using CreateFileMapping work on Pocket PC?
mlepage wrote:How well do memory mapped files using CreateFileMapping work on Pocket PC?


What do you mean? They just work... PocketFrog uses them for loading images.
OK thanks! Next time I rewrite this code, I'll give memory mapped files a try. Right now I just load them into memory, since they're relatively small anyways.
OK I used mapped files, not for this code, but for some other code. It works great on PC, but it isn't working on Pocket PC.

The call that is failing is the call to CreateFileMapping, and once again, GetLastError is returning 0 (or I'm just not sprintfing it correctly).

I'm calling it like this:

HANDLE hMapFile =
CreateFileMapping(
hFile,
NULL,
PAGE_READWRITE,
0,
0,
NULL);

Is read/write not allowed?
You need a different function when opening the file then on the PC. If you don't, the mapping will fail.

PocketFrog only open files for reading, but look it up nevertheless, you might be missing something else.