可以用来远程访问的

解决方案 »

  1.   

    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.
      

  2.   

    调用 DOS命令:
    net user /add 
    即可。