If I add a file as a internal resource with say ID_MYFILE
how can I convert this resource into a string suitable for passing to a function which previously required a path to a file? Can it be done?
Printable View
If I add a file as a internal resource with say ID_MYFILE
how can I convert this resource into a string suitable for passing to a function which previously required a path to a file? Can it be done?
do you mean CString((LPCSTR)ID_) constructor or CString::LoadString() functionality?
t!
You tell me!
I have a function FunctionLoadInit(char *pathtofile)
At the moment I pass a string.
I though I might be able to insert the file as a resource, give it an ID and somehow use this as the parameter, but it must be a string.
I am trying to avoid having to issue a seperate file with my program, thats all.
maybe i still do not understand (why cathegory dialog?)
you want read data from resource given by its name (string)
try to look ak FindResource and LoadResource funtions (RT_RCDATA?)
maybe this helps you
t!
Hi
I put in in this category because I am doing a dialog based application.
The embeded resource needs to be treated as it it were a standard file.
For example, if you embed a BITMAP, you can use MAKEINTRESOURCE
If the contents of the file can be treated as a standard resource you can do this.
Another way to look at this is if you can imbed your file in the resource script as a
string then a call to LoadString should work. I doubt any of the other resource types
would be very helpful. Watch out for binary data in the file - could cause difficulties.
Just give the file an id like any other resource and pass this to the LoadString member
of a CString object.
Do you want the contents of the file or the name of the file in the resource?
Hi
I want the contents of the file.
Basically, I want to add the binary file as a resource, therefore it is embeded in the program, but I then need some way of accessing this data as a binary file.
I could use LoadResource/FindResource to get a HGLOBAL, but I don't have a clue of how to treat this as the equivalent of a binary file stream with read/write facilities.
Any ideas?