PDA

View Full Version : Screensaver resources



Schmedly
07-12-2003, 02:22 PM
I've come to the conclusion that keeping my content data for rendering embedded within the binary is probably the best solution for a Win32 screensaver. That said, the problem is accessing such data once it's embedded as a resource. I've found methods to deal with the bitmaps, but the question is the geometry data, since right now it's in ASCII format. Ultimately the question is this.. has anyone else ever dealt with this? Any suggestions on how to get the ASCII data back once it's thrown into a binary resource?

cragwolf
07-12-2003, 05:38 PM
Look up the FindResource function in the Win32 API help file, and in particular, feast your eyes on the RT_RCDATA resource type. That's the one you should use. Your resource compiler should be able to handle any type of file as resource data. I use Borland's resource compiler and my resource script looks something like:

1 RCDATA "data.raw"

As for information on screensavers, you will find no better page than the following:
http://www.wischik.com/scr/

Jan
07-13-2003, 01:53 AM
Nehe has a tutorial about loading data from a resource.

Jan.

matt_weird
07-13-2003, 07:55 AM
If i got it right, you need to load some ASCII data from the string resource to a buffer. If so, then i'm doing it using LoadString in windows:

int LoadString(
HINSTANCE hInstance, // handle to resource module
UINT uID, // resource identifier
LPTSTR lpBuffer, // resource buffer
int nBufferMax // size of buffer
);

For example:



LPTSTR lpstrStr = new char[255];

LoadString(GetModuleHandle(NULL),IDS_STRING_1,lpst rStr,255);

Hope this helps.



[This message has been edited by matt_weird (edited 07-13-2003).]