C#如何驗(yàn)證提供的Windows賬號(hào)名稱administrator和密碼是否正確?
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace Tc { public partial class Form3 : Form { [DllImport( "Advapi32.dll" )] extern static bool LogonUser( string userName, string domain, string password, int LogType, int dwLogonProvider, ref int Phandle); public Form1() { InitializeComponent(); } private void Form3_Load( object sender, EventArgs e) { int pvalue = 0; bool b = LogonUser( "Administrator" , "localhost" , "8888" , 2, 0, ref pvalue); MessageBox.Show(b.ToString()); } } } 該文章在 2021/2/20 11:17:58 編輯過(guò) |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |