First out, the link Kornelius posted does not work since it has a trailing "," char at the end.. Simply remove it and you will get to topic 16722.
I've already read that post (before answering this one) and to quote Thierry from that thread:
"If I remember correctly, you have two things to do:
1) Call PocketPC::Shutdown() or something similar. Look up how the framework shuts down.
2) Modify PocketPC. There is a problem with pointers not being reset to 0 for the display and input drivers.
Someone already discussed this a few months ago and got it working.
BTW, posting tons of replies won't get you help any faster."and then his second post:
"Oh sorry you are right, there is no PocketPC::Shutdown. I guess you will need to add it.
The problem is with the two following variables (in PocketPC.cpp):
DisplayDriver* l_displayDriver; //fixme: leak at exit
InputDriver* l_inputDriver; //fixme: leak at exit
See the comments? =) You will have to create a Shutdown() function in PPC that destroy these two objects and set them back to NULL.
In Game::Shutdown() after the two pointer resets(), you want to call PocketPC::Shutdown(). This should do it. After that you can reinitialize everything."The reason for not posting an answer is that you already have all the information you need (provided you are prepared to get your hands dirty and look into the actual source file of pocketpc.cpp and realize that the reason you can't start up a window twice is because the global (well, actually local to the file) pointers l_displayDriver and l_inputDriver are never reset to NULL at shutdown (or even worse, the object that it is pointing to is never deleted although all the memory that it once allocated for its members is).
There.. I just said the exact same thing as Thierry did in the other thread.
But since I am a really nice guy I'll even throw in a bonus and that is my modified version of the pocketpc.h/.cpp files where I have added a static function that I chose to name "InvalidateDrivers()". Make sure you call this function in your Game::Shutdown() func after m_display.reset()
I even call it before doing PocketPC::CreateDisplay() in the Game::Init(). This has to do with the fact that the pointers are never properly initialized either. Thierry is heavily relying on the fact that:
"The C standard dictates that any static values that aren't explicitly initialized in the code must be initialized to zero, but nonstatic values are undefined." Also, I needed to be able to call CreateDisplay multiple times. This is probably not supported on the PocketPC platform using GAPI but it is on a WCE platform or desktop using the W32 drivers.
I did this modification since I needed to be able to launch multiple windows using PF and ATL (I had a 800x600 resolution on my PDA). To be able to handle this I also needed to add threads and add some of the stuff that FZammetti later did for PF 0.7.0 to be able to use Heckus together with PF.
To be honest, these modifications is only a quick hack. What you would like is to do a proper delete on these pointers at shutdown and not call the function during init. Hence, rename InvalidateDrivers to Shutdown and then change:
l_displayDriver=0; and l_inputDriver=0;
to
delete l_displayDriver; and delete l_inputDriver;
You can find my modified files at
http://www.nada.kth.se/~t98_hes/pf/ together with some other stuff you may or may not find useful (probably not hugh).
A big appology for once again writing about something that has been dealt with before on this forum.. This seems to be a pattern that is extremely hard to break. I will post a new topic during the weekend containing information about a free WIKI where people can maintain an FAQ and knowledge database (it's sort of like this forum but with a higher ability to cross reference and link between topics and later remove old/outdated/false/non interesting information.)