Resolving OpenInputDesktop Errors: Troubleshooting Favorites Folder Access Issues
Are you facing issues with accessing favorite folders in your application? Discover the root causes and effective solutions to resolve desktop access errors.
1. Issue
The folders in the favorites cannot be opened by clicking, but the items outside the folders can. For example, when downloading WeChat remotely, clicking on the download page doesn’t display it, but the page has actually already been opened.

2. Cause
Through analyzing the logs, it was found that the efficient DXGI screen capture technology was not used, instead, the GDI screen capture technology was adopted. However, the GDI screen capture technology has issues with missing frames.

Further analysis revealed that the call to OpenInputDesktop or OpenDesktop failed, and GetLastError returned error code 2.
3. Solution
Error code 2 means ERROR_FILE_NOT_FOUND, which means the specified file or directory was not found. When an OpenInputDesktop or OpenDesktop call fails, it is usually because the requested desktop cannot be found or accessed.
This error may be caused by the following reasons:
Desktop does not exist: Make sure that the desktop name you requested is correct and that the desktop exists. You can use the EnumDesktops function to list all desktops in the current session and check if the target desktop is in the list.
Permission problem: In some cases, access to the desktop may require administrator privileges. If your program does not have sufficient privileges to access the desktop, try running the program as an administrator or modifying the program’s permission settings.
The desktop has been deleted or is inaccessible: If the requested desktop has been deleted or is inaccessible for some reason, the call to OpenInputDesktop or OpenDesktop will fail. Make sure that the target desktop is active and that there are no other desktop-related problems in the current session.
Name of the desktop object: The first parameter of the OpenDesktop function is the name of the desktop. Make sure that the name is as expected. For example, OpenInputDesktop attempts to open an input-related desktop, ensuring that the target desktop supports that type.