ddyer
ddyer

Reputation: 1786

Embedding data in resource files

Due to some brain damage, (either in windows or in me), there appears to be no API to get the size of a windows resource produced by LoadResource. The return type is HANDLE, but it's not a real handle, and GlobalSize does not work on it.

So absent the API, I need to embed my blobs in some simple format that will wrap them with their length. Surely there must be a utility somewhere that rewrites a file as a length, followed by the contents of the file, or some such trivial encoding.

Upvotes: 1

Views: 90

Answers (1)

Pete Kirkham
Pete Kirkham

Reputation: 49331

Not an answer to your question as to a helper for the work-around, but the API is not missing.

When you called LoadResource, you passed in the module handle and a HRSRC handle. If you call SizeOfResource with the same arguments, it returns the size of the resource.

Upvotes: 1

Related Questions