The D3D9 device could not be created. This may happen if the desktop is locked

RECOMMENDED: Click here to fix Windows errors and optimize system performance

More advanced games are quite sensitive to screen resolution, by the way, if you play them through an external game launcher like Steam. I saw conflicts with the screen resolution, which completely obscured the screen or at least stopped the game. Similarly, a known problem with screen conflict resolution is when players get the error:

The D3D9 device could not be created. This can happen when the desktop is locked

January 2021 Update:

We now recommend using this tool for your error. Additionally, this tool fixes common computer errors, protects you against file loss, malware, hardware failures and optimizes your PC for maximum performance. You can fix your PC problems quickly and prevent others from happening with this software:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.



One possible reason for the error could be that the resolution of the game differs from the current screen configuration, although there may be other reasons for the problem.

You can try the following step-by-step solutions to correct the error:

1] Change the resolution of the game when you start via Steam

If we start the game via Steam, we can start the game in windowed mode. This would help adjust the screen resolution to the resolution of the game. The procedure is as follows:

  1. Right-click anywhere on the desktop and select Display Settings from the list.
  2. Check and note the current monitor resolution. We have to match that to the resolution of the game.
  3. Now start the Steam client for your game and go to Library and then Properties.
  4. On the General tab, click Set Startup Options. Enter the entry as -w 1920 -h 1200 (without codes).
  5. Press OK and exit the display.

Check if this resolution works. We could also try to change the screen resolution if we are not willing to do the same thing with the game.

Another solution is to enter the -windowed command instead of the resolution in Set Launch Options. Then the game started in a smaller window and then we could adjust the size and corners according to our wishes.

2] Manually change the resolution in the game files

If the above method does not work, we can change the resolution of the games by opening the Steam configuration files in a Notepad window on the system and manually editing them. The procedure is as follows:

1] Navigate to the Steam Launcher folder of your game. An example could be Steam/Steamapps/Common/Counter-Strike/CSGame/CSGame/CSGame/Config.

2] Locate the file Machineoptions.ini. Right-click and select Open with. Open it from the options with Notepad.

3] The resolution is specified so that the value of X represents the width and Y the height. Change them according to the screen resolution.

4] Another way to ensure that the configuration always matches the monitor resolution is to delete ; after the X and Y values. Example :

;ResX=1920 ResY=1200

After removing ; of the two values we get,

ResX=1920 ResY=1920 ResY=1200

You can find more information in this feed Reddit here.

RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance

Related Video