   Switch from fullscreen to window
  I'm working in an game using DirectDraw(DirectX 7, not Direct 3D) and I have a little problem changing from fullscreen to window mode and vise-versa:If I'm in window mode and change to fullscreen the screen resolution changes correctly but nothing is drawn (I see the empty window background) Here is my code:  IDirectDraw7 g_pDD; // DirectDraw object  IDirectDrawSurface7 g_pDDSPrimary;// DirectDraw primary surface  IDirectDrawSurface7 g_pDDScreen;   // DirectDraw surface// ......................void SetupDrirectDraw(){...}void I_ChangeFullScreen(){  HRESULT hres;  if (fullscreen)  {    hres == g_pDD->SetCooperativeLevel(hMainWnd, DDSCL_NORMAL);    if (hres != DD_OK)    { Error(); return;    }  }  else  {    hres == g_pDD->SetCooperativeLevel(hMainWnd, DDSCL_EXCLUSIVE or DDSCL_FULLSCREEN);    if (hres != DD_OK)    { Error(); return;    }  }  hres == g_pDD->SetDisplayMode(SCREENWIDTH, SCREENHEIGHT, 32, 0, 0);  if (hres != DD_OK)  {    Error();    return;  }  fullscreen = !fullscreen;}The I_ChangeFullScreen procedure tries to change from fullscreen to window mode and from window to fullscreen. The error function never called (i.e. DirectDraw does not return an error) but when I call my drawing function nothing is drawn:void I_FinishUpdate(){  RECT srcrec;  srcrect.Left = 0;  srcrect.Top = 0;  srcrect.Right = SCREENWIDTH;  srcrect.Bottom = SCREENHEIGHT;    if (g_pDDSPrimary->BltFast(0, 0, g_pDDScreen, srcrect, DDBLTFAST_DONOTWAIT or DDBLTFAST_NOCOLORKEY) == DDERR_SURFACELOST) g_pDDSPrimary->Restore;}Starting the program I call the SetupDrirectDraw procedure that setup DirectDraw. After that everything works fine. But when the I_ChangeFullScreen() is called (using ALT+ENTER keys) the computer's monitor change resolution but nothing is drawn.The SCREENWIDTH and SCREENHEIGHT are 640 and 480.Any ideas????   
  Nothing????;  DirectX 7 is really quite an old interface.  I have never used it.  Try finding a DX7 SDK and comparing how the samples handle the fullscreen/window toggle to your code.   ;  I suspect your problem is in your drawing code (lost surfaces, specifically!) rather than in the display mode code.DirectDraw may "lose" it's allocated surfaces, for example when the display mode is changed the screen surface may be reallocated by DirectDraw.Quote:Original post by Jimmy ValavanisThe I_ChangeFullScreen procedure tries to change from fullscreen to window mode and from window to fullscreen. The error function never called (i.e. DirectDraw does not return an error) but when I call my drawing function nothing is drawn:That's likely because there's no error in the change of display mode, but DirectDraw may report an error in you drawing function instead, when it notices that the surface that's used is lost. I see that you do a check for this on your primary surface.You need to check for DDERR_SURFACELOST and call Restore() on all your surfaces, since either of them may be lost. As a quick test/fix, you might try to also call Restore() on g_pDDScreen when you do it for g_pDDSPrimary. If a bitmap has been loaded onto a surface that's lost, the bitmap has to be reloaded too.Cheers for using DirectDraw by the way, I'm pretty fond of DirectDraw myself. [smile]   