Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

How do I fix the screen when a game I play leaves it messed up on exit?


When I exit from a game named MAFIA II, the screen looks like blended colors
mostly with pink and transparent glass. I can’t read anything on the screen. I
don’t have a graphics card. I have 2 GB of RAM, an Intel Pentium dual core
processor, I have 2.7 gHz. What is the problem and how can I solve it?

In this excerpt from
Answercast #47
, I look at a case where a game is changing the display mode
on a computer and not reverting it on exit.

Become a Patron of Ask Leo! and go ad-free!

Graphics card

Well, I do beg to differ with you on at least one point. You absolutely
have a graphics card. It may not be a separate card, but you most definitely have a
graphics adapter of some sort. Otherwise, you wouldn’t have any screen at

What usually happens in cases like this is that the game has set the
graphics card to a different video mode and then not restored that mode when it

Restore the video mode

The approach, if you can figure out enough of what you can see on the

  • You might try right-clicking on the desktop and hitting Screen
    and then changing the resolution to something that you
    know your system supports.

  • Another approach might be to attach an external monitor to that machine and
    see if that monitor handles whatever video mode the thing is left in.

But, ultimately, what it boils down to is that, like I said:

  • The game has changed the video mode to be something that it needs;

  • And it did not restore the video mode when it finished;

  • And Windows wasn’t made aware of that;

  • So Windows doesn’t know what to do or doesn’t think that anything has
    changed and continues to treat the display as if it’s in the original mode,
    not the mode that the game left it in.

You might want to check with the game’s manufacturer to see if they have a
specific fix for this problem.

Do this

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

I'll see you there!

4 comments on “How do I fix the screen when a game I play leaves it messed up on exit?”

  1. I had the same problem with one of my games, so I looked around in Google for something to help and I found a small program for this called “Iconoid”. You can set it up to resize your screen back to the original settings easily, along with a few other features. So far it has worked fine for me. Go to:

  2. I’ve never really used it, but compatibility mode lets you tell Windows to run the program in 256 colors, 640 x 480 resolution. It sounds to me like the program is switching to those settings.

    If it is, wouldn’t turning on compatibility mode on the games shortcut have Windows control switching the settings before it starts and restoring after it ends, rather than expecting a game (which was likely created a number of years ago) to be doing that?

  3. Although I’ve never used it, Windows has compatibility mode which allows you to select certain screen settings.

    I would expect that by telling Windows to change the screen settings that Windows would revert back to the usual settings when the game is done, rather than expecting the game to do it for you.

  4. After reading your article I wote a Word macro that does the job. It works from Excell as well.
    Copy/Paste the code in Notepad and save the file as mdlScreenResolution.bas .
    Start MSWord.
    Click the Office-button.
    Close the new file you just started.
    Start the Visual Basic editor (press Alt-F11).
    Import mdlScreenResolution.bas (right-click on the Normal project and choose import)
    Save (Contr-s)
    Go back to the Word screen (click the blue “W” icon in the top left corner).
    Click the Office-button again.
    Choose Word options > Customize
    and click the customize button next to Keyboard Shortcuts (so you have two times customize).
    In the categories section (upper-left) scroll completely down and click Macro’s.
    In the Macro’s section click Resolution
    In the press new shortcut key box press a shortcut to your liking (I chose Contr-Shift-Y because it was not yet taken, but you can choose another one, you don’t use yet).
    Go back to the Visual Basic editor and save again.
    You may exit Word.
    Now find a shortcut to Word anywhere an right-click it. Choose properties. In the Shortcut key section choose a shortcut (e.g. Contr-Alt-Shift-W) and click OK.
    Test the macro: Start Word (Contr-Alt-Shift-W)
    Run the macro (Contr-Shift-Y)
    Change the screen resolution.
    Run the macro again. You get your original resolution back. You need those shortcuts, because you do it blind after playing the game.
    Here is the code:

    ‘ Found info on:
    ‘ Thanks to the contributors.

    Private Const sPath$ = “C:\”
    Private Const sFileName$ = “ScreenResolution.tvi”

    Private Declare Function GetSystemMetrics32 Lib “user32” Alias “GetSystemMetrics” _
    (ByVal nIndex As Long) As Long
    Private Declare Function GetSystemMetrics16 Lib “user” Alias “GetSystemMetrics” _
    (ByVal nIndex As Integer) As Integer
    Private Const SM_CXSCREEN = 0
    Private Const SM_CYSCREEN = 1

    Dim bWindowsNT As Boolean
    Const VER_PLATFORM_WIN32s = 0
    Const VER_PLATFORM_WIN32_NT = 2

    Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
    End Type

    Private Declare Function GetVersionEx Lib “kernel32” Alias “GetVersionExA” (lpVersionInformation As OSVERSIONINFO) As Long

    Const EWX_REBOOT = 2
    Const CCDEVICENAME = 32
    Const CCFORMNAME = 32
    Const DM_PELSWIDTH = &H80000
    Const DM_PELSHEIGHT = &H100000
    Const CDS_FULLSCREEN = &H4


    Private Type DEVMODE
    dmDeviceName As String * CCDEVICENAME
    dmSpecVersion As Integer
    dmDriverVersion As Integer
    dmSize As Integer
    dmDriverExtra As Integer
    dmFields As Long
    dmOrientation As Integer
    dmPaperSize As Integer
    dmPaperLength As Integer
    dmPaperWidth As Integer
    dmScale As Integer
    dmCopies As Integer
    dmDefaultSource As Integer
    dmPrintQuality As Integer
    dmColor As Integer
    dmDuplex As Integer
    dmYResolution As Integer
    dmTTOption As Integer
    dmCollate As Integer
    dmFormName As String * CCFORMNAME
    dmUnusedPadding As Integer
    dmBitsPerPel As Integer
    dmPelsWidth As Long
    dmPelsHeight As Long
    dmDisplayFlags As Long
    dmDisplayFrequency As Long
    End Type

    Private Declare Function EnumDisplaySettings Lib “user32” Alias “EnumDisplaySettingsA” (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean
    Private Declare Function ChangeDisplaySettings Lib “user32” Alias “ChangeDisplaySettingsA” (lpDevMode As Any, ByVal dwFlags As Long) As Long
    Private Declare Function ExitWindowsEx Lib “user32” (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
    Private Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Private Type LUID
    lowpart As Long
    highpart As Long
    End Type

    pLuid As LUID
    Attributes As Long
    End Type

    PrivilegeCount As Long
    End Type

    Sub Resolution()
    End Sub

    Sub SaveVideoInfo()
    If Dir(sPath & sFileName) = “” Then
    Dim vidWidth As Integer, vidHeight As Integer

    If Left(Application.Version, 1) = 5 Then
    vidWidth = GetSystemMetrics16(SM_CXSCREEN)
    vidHeight = GetSystemMetrics16(SM_CYSCREEN)
    vidWidth = GetSystemMetrics32(SM_CXSCREEN)
    vidHeight = GetSystemMetrics32(SM_CYSCREEN)
    End If
    Open sPath & sFileName For Output As 2
    Print #2, vidWidth & “,” & vidHeight
    Close 2
    End If
    End Sub

    Private Sub ChangeScreenResolution()
    Dim vidWidth As Integer, vidHeight As Integer

    If Left(Application.Version, 1) = 5 Then
    vidWidth = GetSystemMetrics16(SM_CXSCREEN)
    vidHeight = GetSystemMetrics16(SM_CYSCREEN)
    vidWidth = GetSystemMetrics32(SM_CXSCREEN)
    vidHeight = GetSystemMetrics32(SM_CYSCREEN)
    End If
    If Dir(sPath & sFileName) = “” Then
    Exit Sub
    End If

    Dim DevM As DEVMODE
    Dim lResult As Long
    Dim iAns As Integer
    OSInfo.dwOSVersionInfoSize = Len(OSInfo)
    Call GetVersionEx(OSInfo)
    bWindowsNT = (OSInfo.dwPlatformId = VER_PLATFORM_WIN32_NT)
    lResult = EnumDisplaySettings(0, 0, DevM)
    Open (sPath & sFileName) For Input As 1

    With DevM
    Input #1, .dmPelsWidth, .dmPelsHeight
    If .dmPelsWidth = vidWidth And vidHeight = .dmPelsHeight Then
    Exit Sub
    End If
    End With
    lResult = ChangeDisplaySettings(DevM, CDS_FULLSCREEN)
    Select Case lResult
    ExitWindowsEx EWX_REBOOT, 0
    ChangeDisplaySettings DevM, CDS_UPDATEREGISTRY
    Case Else
    End Select
    End Sub


Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.