C#如何验证提供的Windows账号名称administrator和密码是否正确?
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
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 编辑过 |
关键字查询
相关文章
正在查询... |