Windows Vista added a new feature called the "Secure Desktop". It looks great and really draws the user's attention. But now, I want to use this desktop in my .NET/C# or Delphi/WIN32 application. And use it for my own dialog, which will ask the user for about 5 different but sensitive pieces of information.
Is there a way to use it in .NET? Is there a way to use it开发者_如何学Go in WIN32?
You may want to ask the team that made KeePass. They have implemented in their program the ability to input the master password for their database within the windows Secure Desktop, in order to avoid keyloggers.
Also, their program is open source and the source can be downloaded here: http://keepass.info/download.html
If you think about it, you'll discover that there's no way to change that secure desktop.
The secure desktop is above the normal desktop, with everything else disabled. And it doesn't allow normal programs to interfere with it (otherwise it would be useless).
And AFAIK it also runs with elevated privileges so it can elevate whatever it was called for if you click on "yes".
All you can do is try to emulate the secure desktop by taking a screenshot of the current desktop, darken that image, then create a top-level window, draw that image in it, then show a dialog with buttons on it (also as a top-level window). But of course, a simple alt-tab will allow users to switch back.
It seems like Secure Desktop is achieved by using the following Windows API methods:
CreateDesktop()
SwitchDesktop()
CloseDesktop()
SetThreadDesktop()
GetThreadDesktop()
GetCurrentThreadId()
C# Secure Desktop implementation @ CodeProject
MSDN Window Station and Desktop Functions reference
精彩评论