Click here to get back home

Data File Location On Smartphone 5.0 SDK

 HomeNewsGroups | Search | About
 microsoft.public.smartphone.developer    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Data File Location On Smartphone 5.0 SDK Mo 01-04-2008
Get Chitika Premium
Posted by Mo on January 4, 2008, 1:35 pm
Please log in for more thread options
I am developing a video game with C++ on Visual Studio 2005 for a Windows
Mobile 5.0 Smartphone device (using the 5.0 SDK). The level data for our game
is stored in binary files created with a tile editor tool which exports the
data to a .dat file. The problem I'm having is that I don't know where to
put those data files to be read iwthin the code using WIN32_FIND_DATA
functionality. I had difficulty reading bitmaps in a similiar way but was
able to get around that by embedding them as resources within the project.
Can somebody tell me either a) where to put the files for development and
eventual deployment on the device or b) how to work with binary files as
resources.
Thank You

Posted by Scott Seligman on January 4, 2008, 2:38 pm
Please log in for more thread options
>
>I am developing a video game with C++ on Visual Studio 2005 for a Windows
>Mobile 5.0 Smartphone device (using the 5.0 SDK). The level data for our game
>is stored in binary files created with a tile editor tool which exports the
>data to a .dat file. The problem I'm having is that I don't know where to
>put those data files to be read iwthin the code using WIN32_FIND_DATA
>functionality. I had difficulty reading bitmaps in a similiar way but was
>able to get around that by embedding them as resources within the project.
>Can somebody tell me either a) where to put the files for development and
>eventual deployment on the device or b) how to work with binary files as
>resources.

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

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
>

Similar ThreadsPosted
WM5 Cab file prompt for location May 8, 2007, 1:46 pm
sample code for xml data file August 16, 2007, 8:47 pm
How to read data from EXCEL file from my application for win mobil April 23, 2008, 6:16 am
Want to generate log for changes in Smartphone Data June 2, 2005, 11:49 pm
Data Storage on Smartphone - MVPs please advise May 31, 2005, 9:53 am
Adjusting the column width on a SmartPhone Data Grid. September 18, 2006, 12:54 pm
Location with GPS receiver April 26, 2006, 6:44 pm
Work URL Exception Location June 21, 2007, 7:34 pm
Disable the "Choose a location" dialog on install December 13, 2005, 12:59 pm
How do I capture in real time signal strength and GPS location? November 3, 2006, 12:09 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap