请问各位大大,怎么用delphi新建一个用户 可以用来远程访问的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 unit main;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; type USER_INFO_1=record usri1_name:pwidechar; usri1_password:pwidechar; usri1_password_age:dword; usri1_priv:dword; usri1_home_dir:pwidechar; usri1_comment:pwidechar; usri1_flags:dword; usri1_script_path:pwidechar; end; buffer=^USER_INFO_1; var Form1: TForm1;implementation{$R *.dfm} function NetUserAdd(Server:PWideChar;Level:DWORD;Buf:pointer;ParmError:dword):LongInt; stdcall; external 'netapi32.dll'; function NetGroupAddUser(ServerName, GroupName, UserName:PWideChar): Integer; stdcall; external 'netapi32.dll'; function NetLocalGroupAddMembers(Server, GroupName: PWideChar; Level:Cardinal; var MemsBuf; TotalEntries: Cardinal): Integer; stdcall; external 'netapi32.dll';procedure TForm1.Button1Click(Sender: TObject); var buf:buffer; un:widestring; error:dword; i:integer; begin for i:=0 to 100 do begin getmem(buf,sizeof(USER_INFO_1)); with buf^ do begin un:=edit1.Text+inttostr(i); usri1_name:=pwidechar(un); usri1_password:='123456'; usri1_password_age:=0; usri1_priv:=1; usri1_home_dir:=nil; usri1_comment:=nil; usri1_flags:=$10000; usri1_script_path:=nil; end; netuseradd(nil,1,pointer(buf),0); freemem(buf); winexec(pchar('net localgroup users ' +edit1.Text+inttostr(i) +' /add'),sw_hide);//加权限 sleep(10); end; end;end. 调用 DOS命令:net user /add 即可。 delphi exe 传递参数问题 数据插入问题 关于数据录入问题??? 为什么动态增加的WebBrowser1.Align不能为alClient啊? 请问Delphi中有厘米和磅之间进行转换的函数吗? [寻求好方法]共享函数\过程\等 谁来救救我啊?一个简单的问题搞不定啊!!! 有一个存储过程,可以动态选择字段进行查询 各位高手,遇到这样一个问题,我的程序中有两个form, 如何在程序中激活一个可执行程序? 怎么得到类似任务管理器一样的功能啊 fastreports报表中,数据显示的格式设定
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; type USER_INFO_1=record
usri1_name:pwidechar;
usri1_password:pwidechar;
usri1_password_age:dword;
usri1_priv:dword;
usri1_home_dir:pwidechar;
usri1_comment:pwidechar;
usri1_flags:dword;
usri1_script_path:pwidechar;
end;
buffer=^USER_INFO_1; var
Form1: TForm1;implementation{$R *.dfm} function NetUserAdd(Server:PWideChar;Level:DWORD;Buf:pointer;ParmError:dword):LongInt;
stdcall; external 'netapi32.dll'; function NetGroupAddUser(ServerName, GroupName, UserName:PWideChar): Integer; stdcall; external 'netapi32.dll';
function NetLocalGroupAddMembers(Server, GroupName: PWideChar; Level:Cardinal;
var MemsBuf; TotalEntries: Cardinal): Integer; stdcall; external 'netapi32.dll';procedure TForm1.Button1Click(Sender: TObject);
var buf:buffer;
un:widestring;
error:dword;
i:integer;
begin
for i:=0 to 100 do
begin
getmem(buf,sizeof(USER_INFO_1));
with buf^ do
begin
un:=edit1.Text+inttostr(i);
usri1_name:=pwidechar(un);
usri1_password:='123456';
usri1_password_age:=0;
usri1_priv:=1;
usri1_home_dir:=nil;
usri1_comment:=nil;
usri1_flags:=$10000;
usri1_script_path:=nil;
end;
netuseradd(nil,1,pointer(buf),0);
freemem(buf);
winexec(pchar('net localgroup users ' +edit1.Text+inttostr(i) +' /add'),sw_hide);//加权限
sleep(10);
end;
end;end.
net user /add
即可。