Click here to Skip to main content
15,843,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am getting Virtual Desktop of each running process (by handles) by Using Windows APIs and following code snippet.

What I have tried:

C#
List<IntPtr> handles = GetWindowsHandles();

foreach (var hWnd in handles)
{
VirtualDesktop Virtual_Desktop = VirtualDesktop.FromHwnd(hWnd);
}


But when handle of Msedge and Notepad++ is passed to this method, Virtual Desktop is null.
Posted
Comments
Richard Deeming 29-Sep-22 8:18am    
The VirtualDesktop class doesn't appear to be a build-in class. Is it one you've created, or from a third-party library?
DoingWork 29-Sep-22 8:25am    
I have installed NuGet Package VirtualDesktop.WPF v5.0.5
DoingWork 29-Sep-22 8:29am    
https://github.com/Grabacr07/VirtualDesktop/blob/7f08403bf242f3faf609b91553603777b879d84c/src/VirtualDesktop/VirtualDesktop.cs
At this link, It is mentioned that
Returns null if the handle is not associated with any open windows.
But there are multiple tabs are opened in both Msedge and Notepad++

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900