PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Developing using VC6++ instead of eVC ?

I have read on PocketMatrix that many people do most of their development on VC6 & only use eVC as required to finish the game, mainly to save time & allow work without device/emulation.

Until now I have only played with VC6 & have not tried to get my PF project working with VC6.

What are the things I need to know for VC6?, eg:
1. how create a project ( insert all files etc )
2. use sound libraries ( I assume I can't unless I have source of the library )
3. Loading files ( any issues here? )

What other issues are there?

thanks in advance
.............
Update:
First problem I have hit is with Unicode:
I added defines for UNICODE & _UNICODE plus TCHAR into the winnt.h file ( not sure if that's the correct place.)

Everything seems to complie ok however I get 1 error saying that :-

Code:
C:\Windows CE Tools\frog\PocketFrog_0_6_0\samples\treker\treker.cpp(281) : error C2731: 'WinMain' : function cannot be overloaded
C:\Windows CE Tools\frog\PocketFrog_0_6_0\samples\treker\treker.cpp(280) : see declaration of 'WinMain'

Seems to think I have re-defined WinMain ???
Any clues?
BurningSheep · 02 Feb 2003, 19:16 UTC
Creating a project in VC6 is exactly the same as in EVC, so there shouldn't be any problems there. Except that you'll have to add every file twice, once for your EVC project and once for the VC6 project.

Which sound lib are you using again? MikMod and FMOD libraries are available for x86 so that shouldn't be a problem.

Loading files... hmmm, that one is only awkward on your PPC (with the absolute path stuff)

Other problems... maybe you'll run into problems with strings, since ppc only uses unicode, nothing major though. There've been lots of threads about it on PM (gen. dev. mostly)
The only problem I´m having on the vc6 is with the Registry writes, my registry function is hanging on x86, on the emu and on the devices it works perfectly, but not on x86 :x
adde · 03 Feb 2003, 16:14 UTC — Developing using VC6++ instead of eVC ?
Conan wrote:
1. how create a project ( insert all files etc )
2. use sound libraries ( I assume I can't unless I have source of the library )
3. Loading files ( any issues here? )


Like BurningSheep pointed out, the only hassle is with unicode and absolute path. I solve this with precompiler instructions, like this:
Code:

// You'll need these
#include <string>
#include <tchar.h>

// An example of how one of my GUI classes work.
Button::Button(Frog::DisplayDevice* display, const TCHAR* filename, const int& button_width, const int& button_height)
{
#if _WIN32_WCE
std::wstring fname = L"";
fname += std::wstring(filename);
m_pButton = Frog::LoadImage(m_pDisplay, fname.c_str());
#else
m_pButton = Frog::LoadImage(m_pDisplay, filename);
#endif
}

It assumes that all the project resource files are located in the root directory of the PDA, and in the same directory as the .exe file on PC.

When reading/writing to my settings.ini file, I just ignore the unicode stuff (and as you can see, the path aswell)
Code:

// This will load the settings from local file (settings.ini)
// [out] : returns true if successful, false otherwise
bool Settings::Load()
{
// Open file (for reading)
FILE* file = fopen(m_FileName.c_str(), "r");
if (!file)
return false; //error opening file

// Load settings
char line[80];
while (fgets(line, sizeof(line), file))
{
// Ignore commented lines
if (line[0] == '#')
continue;

// Remove the CR/NL at the end of the line (if it's there)
if (line[strlen(line)-1] == '\r' || line[strlen(line)-1] == '\n')
line[strlen(line)-1] = 0;

// Test line and set parameter
// (using Set-functions to keep validation in only one place
// AND to keep it thread safe)
if (strncmp(line,"userlevel:",10) == 0)
{
SetUserLevel(atoi(&line;[10]));
}
else if (strncmp(line,"ip:",3) == 0)
{
SetIP(&line;[3]);
}
else if (strncmp(line,"port:",5) == 0)
{
SetPort(atoi(&line;[5]));
}
...
}

// Close file
fclose(file);

// Mark the settings as NOT changed (since last save/load)
m_bHasChanged = false;

return true;
}


Conan wrote:
I added defines for UNICODE & _UNICODE plus TCHAR into the winnt.h file ( not sure if that's the correct place.)


You should avoid changing standard header files (and/or source files) because they are assumed to be the same on all systems. Imagine you want to share your code with others. Then they need to know what "extra" changes need to be done before they can compile. That's not a good idea.

What I suggest is that you either:
1. In those files that use UNICODE and _UNICODE (or whatever else you need specialized) you define it with preprocessor defines:
Code:

#if _WIN32_WCE
#define itoa _itoa
#endif
2. Put all these defines (with preprocessor code) and includes in a single include file that you include in the affected files.

The TCHAR macro is defined in <tchar.h> and this header is included in the <windows.h> on CE but not on PC. So all you need to do here is add the <tchar.h> to all the affected files (or do like #2 above).

The WinMain error is a bit hard to guess since I don't have the code. There is no special trick with the WinMain, as long as the compiler associates it with the entry point of the program (and if it didn't, you'd get a difference error message).

The only problem I´m having on the vc6 is with the Registry writes, my registry function is hanging on x86, on the emu and on the devices it works perfectly, but not on x86

I don't find this the least bit surprising, since CE and PC use different registries (or so I assume). My advice is to use the precompiler technique discussed above and make shure the PC code doesn't violate any restrictions if you absolutely MUST use the registry (I can't figure out why but hey, that's just me).
It assumes that all the project resource files are located in the root directory of the PDA, and in the same directory as the .exe file on PC.


OR, in the VC6 project directory on PC. You don't have to duplicate everything and put it into Debug AND Release directories. Having it in the project root directory will suffice.

Sorry bout that =)
Conan · 04 Feb 2003, 20:02 UTC — Many thanks for your reply Adde
Thanks for the very helpfull reply. I will take your suggestions and the others from previous posts onboard.

Currently I have 2 eVC dev systems which I keep in step but when using the 2002 emulator I can never tell whether the system will work properly. Sometimes the emulator starts fine but files won't copy other times it's perfect. My hope is that VC6 once set up correctly ( and PocketGL also helps here as it comes with code driven by complier directives ) will speed up my development.

Onward & upward ....
I´m wondering if its possible to compile for the pocket pc platform using VC6, I can see the platform option, but I don´t know how to add mips,arm,sh3... Does anyone knows how to do it?
Just for reference... the only files that are different between eVC and VC++ are the project files. Evertyhing else is identical, even resource descriptors. This makes life considerably simpler. If you use the unicode-defined versions of all string functions you'll find that you can avoid preprocessor directives completely, except for file loading (although when using GapiDraw this is necassery, I'm wondering if it does the pathing for you internally... might be a nice addition for PF if that's the case).