Search code examples
c#winformsdesktopvirtual-desktop

Disposing of Virtual Desktop (C#/WinForms)


I have created a Virtual Desktop Manager for a client that allows him to organize his Desktop a little better by separating business from personal, etc etc.

But, before I send it to him, I need to learn how to Dispose of a desktop that was created by him. For example, if I create a new virtual desktop, then later on when I've finished with the program, I would want all virtual desktops that were created to be Disposed of, obviously...

But, months later, I cannot find this documentation on MSDN anymore. It looks like the layout and info has been moved around.

Can someone please help? Any help is really appreciated.

Thank you!


Solution

  • According to MSDN Window Station and Desktop Functions and CreateDesktop Function :

    If the function succeeds, the return value is a handle to the newly created desktop. If the specified desktop already exists, the function succeeds and returns a handle to the existing desktop. When you are finished using the handle, call the CloseDesktop function to close it.