Ok, first of all, I'm not sure if this belongs to C section. Since WinAPI is written in C, I'll post here. I'm using OpenGL with Win32 windows (not sure how to call that). I can't switch to fullscreen mode after creating the window. I'm using Windows 7 (64-bits) and VS 2008. Here's the part of the code where I switch to fullscreen mode:

DEVMODE dmScreenSettings;

// ...

  memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
  dmScreenSettings.dmSize = sizeof(dmScreenSettings);
  dmScreenSettings.dmPelsWidth = ContextPtr->ScreenWidth;
  dmScreenSettings.dmPelsHeight = ContextPtr->ScreenHeight;
  dmScreenSettings.dmBitsPerPel = ContextPtr->ScreenDepth;

  if(ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
    ContextPtr->Fullscreen = false;

I've tried copying some code from SDL (SDL_dibvideo.c), but it didn't work either. There's a similar example in some book on games development:
(the link was a bit long)

Need help :)

ChangeDisplaySettings returns DISP_CHANGE_BADMODE, which means that the display mode is not supported. It works with 32-bit depth, I was trying to use 24-bit depth. I guess this thread is solved now. Thank you for your help Salem.

commented: Good detective work :) +17