禁用系统帐号(USER_INFO_1008)的实例
[@more@]Option ExplicitPrivate Const ERROR_SUCCESS As Long = 0 Private Const UF_SCRIPT As Long = &H1 Private Const UF_ACCOUNTDISABLE As Long = &H2 Private Type USER_INFO_1008 usri1008_flags As Long End Type Private Declare Function NetUserSetInfo Lib "Netapi32" _ (servername As Byte, _ username As Byte, _ ByVal level As Long, _ bufptr As Long, _ parm_err As Long) As Long Private Declare Function NetApiBufferFree Lib "Netapi32" _ (
判断当前用户是否为系统管理员的实例
[@more@]Option ExplicitPrivate Declare Function IsUserAnAdmin Lib "shell32" () As Long Private Sub Form_Load() Command1.Caption = "IsUserAnAdmin" Label1.Caption = "" End Sub Private Sub Command1_Click() Select Case IsUserAnAdmin() Case 1: Label1.Caption = "YES" Case False: Label1.Caption = "NO" End Select End Sub
检验系统帐号是否存在的实例
[@more@]Option Explicit Private Declare Function LookupAccountName Lib "advapi32" _ Alias "LookupAccountNameA" _ (ByVal lpSystemName As String, _ ByVal lpAccountName As String, _ Sid As Byte, _ cbSid As Long, _ ByVal DomainName As String, _ cbDomainName As Long, _ peUse As Long) As Long Private Sub Command1_Click() Dim sAccount As String 'account name of interest Dim sSystem As String 'specifying the system Dim sDomain A
获取系统帐户密码周期的实例
[@more@]在界面上添加一2个lable,1个textbox,1个button.代码如下:Option ExplicitPrivate Const NERR_SUCCESS As Long = 0&Private Type USER_INFO_1 usri1_name As Long usri1_password As Long usri1_password_age As Long usri1_priv As Long usri1_home_dir As Long usri1_comment As Long usri1_flags As Long usri1_script_path As LongEnd TypePrivate Declare Function NetUserGetInfo Lib "Netapi32" _ (Servername As Byte, _ Username As Byte, _ ByVal Level As Long, _ Buffer As Lon
用VB写的一个组件,实现添加系统用户,并添加到指定组
[@more@]声明部分 Option Explicit Const NERR_Success = 0 Const ERROR_MORE_DATA = 234& Const MAX_PREFERRED_LENGTH = -1& Const LG_INCLUDE_INDIRECT = &H1 Const User_Priv_User = &H1 Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000 Const NERR_BASE = 2100 Const MAX_NERR = NERR_BASE + 899 Const LOAD_LIBRARY_AS_DATAFILE = &H2 Const FORMAT_MESSAGE_FROM_HMODULE = &H800 Type TUser1 ’ Level 1 ptrName As Long ptrPassword As Long dwPasswordAge As Long dwPriv As Long ptrHomeDir As Long ptr