home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 April
/
Chip_2002-04_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
NT.ZIP
/
NTAddLocalGroup.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-06-20
|
2KB
|
62 lines
unit NTAddLocalGroup;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TNTAddLocalGroup = class(TComponent)
private
{ Private declarations }
FGroup:String;
FComment:String;
FServer:String;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Server:String read FServer write FServer;
property GroupName:String read FGroup write FGroup;
property Comment:String read FComment write FComment;
function Execute:LongInt;
end;
Type LOCALGROUP_INFO_1=record
lgrpi1_name:LPWSTR; lgrpi1_comment:LPWSTR;End;
function NetLocalGroupAdd(Server:PWideChar;Level:DWORD;Buffer:PChar;ParmError:PChar):LongInt; stdcall; external 'netapi32.dll';
procedure Register;
implementation
function TNTAddLocalGroup.Execute:LongInt;
var
MyInfo:LOCALGROUP_INFO_1;
MyGroup:Array[0..255] Of WideChar;
MyComment:Array[0..255] Of WideChar;
MyServer:Array[0..255] Of WideChar;
begin
StringToWideChar(FGroup,@MyGroup,255);
StringToWideChar(FComment,@MyComment,255);
MyInfo.lgrpi1_name:=@MyGroup;
MyInfo.lgrpi1_comment:=@MyComment;
If FServer<>'' Then
Begin
StringToWideChar(FServer,@MyServer,255);
Result:=NetLocalGroupAdd(@MyServer,1,@MyInfo,nil);
End Else
Begin
Result:=NetLocalGroupAdd(nil,1,@MyInfo,nil);
End;
end;
procedure Register;
begin
RegisterComponents('NT Tools - Local', [TNTAddLocalGroup]);
end;
end.