Link to home
Start Free TrialLog in
Avatar of unni_bcanti
unni_bcanti

asked on

File Operations in eVB & Pocket PC 2002

Hello Experts..
Let me explain the problem first. It may not be clear without this long intro.
I have developed a strategy game in eVB using ATL based COM component in eVC.
Whole game logic is implemented in eVB where COM is used only for declaring objects since evb lacks this ability. 3 objects are declared in COM - say, PlanetObj, PlayerObj, ShipObj.
and I'm creating arrays of these objects in eVB using CreateObject() function. PlayerObj has 69 Properties, PlanetObj has 44 Properties, and ShipObj has 19 properties. And object arrays are declared as
Dim Planets(58) as PlanetObj , Players(3) as PlayerObj, Ships(7) as ShipObj.
And problem is not here. the game is working smooth and fine, so far.

But Now I've to implement a 'save game' option for middle way exit, and to reopen at a later time. for this I've tried 'File control' for serializing these object properties.

First I tried textmode writing using inbuilt methods. 'WriteFields' method properly wrote all the stuff to a text file which can be viewed in any text editor. But when I retrived it using 'InputFields' It gave all stuffs in a variant array, but all the string properties are not the same which I saved and viewd in text file.

for example :- planets(0).name was "Earth" when I saved,
but it gives strange values like "Width" , "GetTypeInfo" , "Arial"  etc on retrieval.

And when I tried binary mode- get & put file operations of 'File control' it solves the string field problems, but It doesnt save the whole 3000 above variables in a single binary file. It save and retrieves first half portion correctly. but the variables saved towards the last portion of the file are not the same values as I saved.
What could be the problem with it ?
Could I able to explain the problem correctly !!!!! ?
Anyone there to shred some light on these topics ?
(Please dont suggest any 3rd party tools. )

Thanx in advance

Unni.K.S
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of unni_bcanti
unni_bcanti

ASKER

Thanx..
Let me tryout the first link.
I'm using eVB3 , eVC3 & PocketPC2002 SDK.

And I think eVC 4 is exclusively for PPC 2003. right?
I'm targetting PPC2002 also for my game.
eMbedded Visual Tools 3.0
This comprises eMbedded Visual Basic (eVB) 3.0 and Visual C++ (eVC) 3.0 which are based on the Visual Studio 6.0 development environment and allow you to write Windows CE applications, including applications for Pocket PC 2002 and Handheld PC 2000, using Visual C++ or Visual Basic. Any Windows CE SDK, such as the Pocket PC 2002 SDK, can be installed, so eVB and eVC can develop applications for any type of Windows CE device.
      SDKs do vary in the tool support they provide but, for example, the Pocket PC 2002 SDK allows applications to be developed using a tailored version of MFC (Microsoft Foundation Classes) and ATL (ActiveX Template Libraries). The eVB language is more closely related to VBScript than Visual Basic, and is not currently supported by the Smartphone 2002 SDK.

eMbedded Visual C++ 4.0
The latest version of eVC is used to produce applications for Windows CE .NET devices. This allows ‘unmanaged’ native code applications to be produced, whereas the .NET Compact Framework produces applications using MSIL ‘managed code’. eVC 4.0 is expected to co-exist with the .NET Compact Framework as it provides complete access to the underlying Windows CE .NET API functions.

I could develop a solution for the file writing problem using 'devbuzz' sample.
I was writing and reading using ansi strings.
Unicode mode writing & reading solved my problem.
I can give these points to you.

Thanks mikal.