Problem with displaymode switching

Hi there.
I’ve got serious problems with my code that switches the screen resolution etc… If I’m starting the program the first time nothing unusual happens. But always while exitting the second session, the program hangs at the ChangeDisplaySettings( NULL, 0 ) command.
I tried to set the resolution afterwards manually and the windows dialog also hangs.
Has anybody an idea?
I could post some code as well, if that would help.

At NeHe page is working code for that.

[CS]

Well, I know one can go to some pages and do cut-and-paste programming, but that doesn’t satisfy me.
In win98, it HANGS !!!IN!!! the ChangeDisplaySettings(NULL,0) upon the second exit of the “game”. In WinNT it doesn’t hang at all. What could cause that?

Well, NeHe means that it can make the desktop corrupt if one first destroys the window and then switches back to normal graphics mode, which is actually what I’m doing. Trying that out. Gonna ask mccraighead for an answer in the advanced board.