Invoking the Windows Security Dialog (in C# or VB.NET)

前端 未结 5 1211
你的背包
你的背包 2021-02-06 04:31

I would like to know how to invoke the Windows Security Dialog (press ctrl+alt+del on a windows workstation NOTE: I don\'t want the task manager!) programmatically.

5条回答
  •  再見小時候
    2021-02-06 05:13

    Security features might be standing in your way to programmatically manage security-related features like Security Dialog through CtrlAltDel. I've been running into the same kinds of problems.

    About your request to invoke password change dialog.

    IADsUser

    "designed to represent and manage an end-user account on a network [and locally]."

    If you find yourself short on solutions, you might whip up your own quick Windows form with password fields and communicate with the Windows IADsUser Interface using the WinNT provider to bind to a local (instead of network) user account on the XP machine.

    GetObject("WinNT://MYCOMPUTER/jeffsmith,user") //WinNT provider
    

    ... and use the ChangePassword(..) method (links to code sample).

    usr.ChangePassword szOldPass, szNewPass
    

    If you're trying to invoke the Windows features directly to cause the user to trust the process then admittedly a custom form for changing a password might look a bit goofy.

    RunDLL32

    Another avenue you might try is programmatically invoking RunDLL32.exe at the command line and targeting the correct Win DLL to bring up the password change dialog box. One forum said the following works in XP if SP2 isn't installed. I can't test it because I'm on Vista.

    rundll32.exe shell32.dll,Control_RunDLL password.cpl
    

    You can Google for many of these, however it does seem to come up short as far as changing the password or invoking Windows security dialog.

    Microsoft's info about Run32Dll

提交回复
热议问题