|
Posted by Mo on January 4, 2008, 4:16 pm
Please log in for more thread options Thank you very much for the reply, Scott. However, I'm still having
difficulty getting the resource into the game. I've tried both methods:
1) I've placed the data file, pzdata.dat, into what I think is the same
folder as the executable "GameProject\Windows Mobile 5.0 Smartphone SDK
(ARMV4I)\Debug\pzdata.dat". That directory is where the GameProject
executable is. However, when I run this code:
HANDLE hFind;
WIN32_FIND_DATA FindFileData;
hFind = FindFirstFile( L"pzdata.dat", &FindFileData );
I get an INVALID_HANDLE_VALUE for hFind. Perhaps am I putting the data file
in the wrong place?
2) I import the .dat files as a resource and give it type RT_RCDATA (which
according to the documentation is an Application Defined Raw Resource). I
give it the ID MAP_DATA1 in the properties window. Then I try to find the
resource with this code:
HRSRC resource;
resource = FindResource( NULL, MAKEINTRESOURCE( MAP_DATA1 ), RT_RCDATA );
When I do this the "resource" variable is undefined. I'm hoping I'm just
missing a simple step but so far nothing has worked. Is there anything else
I can try.
Thank you again.
CM
> You should be able to simply place the data files in the same folder
> that you install your executable too and read them like any other
> file.
>
> That said, if you want to embed them as a resource, just use
> FindResource(), LoadResource(), LockResource(), and SizeofResource()
> to get the binary data of the resource and parse it however you need
> to.
>
> --
> --------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
> It's a very sobering feeling to be up in space and realize that one's
> safety factor was determined by the lowest bidder on a government
> contract. -- Alan Shephard
>
|