Many users have come across a problem where they encounter an error “Failed to create the d3d9 device. This can happen if the desktop is locked” on their screens whenever they try to play a game directly or through other game launchers such as Steam.
The reason why this error occurs is mainly due to the conflict in the resolution of the game you are trying to launch and the current monitor resolution. If there is a mismatch, this condition might occur. There are also several other causes of this error which we will be discussing below.
Solution 1: Changing Resolution of the game (Steam)
The easiest workaround to solve this issue is launching the game in ‘windowed’ mode. This solution is targeted for people playing games using Steam. When launching the game via Steam, the game doesn’t launch at all and the error message keeps popping. Follow the steps listed below:
Before we go to changing the resolution of Steam, we need to check the current resolution of your monitor so we can set according to it.
- Right-click anywhere on your Desktop and select “Display settings”.
- Check the current resolution set on your computer. Here it is 1920 x 1200.
- Once you have noted the resolution, fire up your Steam client. Click on Library tab. Right-click on the game and select Properties.
- Click the General tab and select Launch options from the list of options available. Now set your current resolution. An example of setting 1920 x 1200 resolution in the launch options is “-w 1920 –h 1200”.
- Press OK to save changes and exit. Relaunch the Steam client and check if you can properly run your game.
You can also experiment with different resolutions possible in the Steam client. You can also change the resolution on your computer and then update the launch option from the client.
Another possible workaround is to launch the game in ‘windowed’ mode. In this mode, there is no set resolution and the game will launch in a small window screen. You can easily change the dimensions of the screen by dragging the edges. The command to set windowed mode is “-windowed”.
Tip: You can also set the launch option as “-dxlevel 81”. This will force the game to launch the mentioned DirectX mode.
Solution 2: Installing DirectX End-User Runtimes
DirectX is a collection of API’s meant for handling tasks related to multimedia, especially games. If you do not have the module installed already, you should add it to your system as soon as possible and see if this does the trick.
- Navigate to Microsoft’s official DirectX
- Click on the Download button and download the package to an accessible location.
- Install the package on your computer. After installing, check if the problem got solved and you are able to run your game without any difficulties.
Solution 3: Manually changing the resolution in game files
If both the above methods don’t work for you, we can try changing the game’s resolution by changing some of the game files manually in Steam’s folder. Do note that it is wise that you make a copy of the config files and store it at a separate location so you can replace it if something goes wrong.
- Navigate to the directory of your game. A sample directory is:
- Now open the file “Machineoptions.ini” by right-clicking it select, hovering over ‘open with’ and selecting Notepad. You can also directly open the file by clicking it and when Windows prompts you, select Notepad.
- Now we are going to do a little trick. We are going to remove ‘;’ from the resolution command and keep the value same. So initially, you will the strings as:
After removing the colons, you will see something like:
- Save the changes and exit. Restart your computer properly and try launching the game.
Solution 4: Updating Graphics Drivers
If all the above methods fail, it probably means that there is a problem with the current drivers installed on your computer. If you have corrupt or outdated drivers, it may be the reason why your game fails to switch to your computer’s default resolution and the error message appears. Now there are two ways through which you can update the drivers: either manually or automatically. In manually, you have to personally download the driver after searching for it at the manufacturer’s website.
Before updating drivers, we will check if installing the default drivers solve the problem for us.
- Boot into Safe mode. Type “devmgmt.msc” in the dialogue box and press Enter. Here navigate to Display Adapters, right-click on your adapter and select Uninstall Device.
- Boot your computer into normal mode, press Windows + R, type “devmgmt.msc” in the dialogue box and press Enter. Most probably the default drivers will be installed. If not, right-click on any empty space and select “Scan for hardware changes”. Now check if the game works without any problems. If it does without any problems, good for you. If it doesn’t, carry on.
- Now there are two options. Either you can search online for the latest driver available for your hardware from the manufacturer’s website such as NVIDIA etc. (and install manually) or you can let Windows install the latest version itself (search for updates automatically).
- We will take a look at installing manually. Right-click on your hardware and select “Update driver”. Select the first option “Search automatically for updated driver software”. Choose the second option if you are updating manually and select “Browse for driver” and navigate to the location where you downloaded.
- Restart your computer after installing the drivers, launch the game and check if this solves the problem.