 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
David Guest
|
Posted: Sat Aug 06, 2005 12:01 pm Post subject: Need help to make NetJoinDomain API call |
|
|
Can anyone help me make thisAPI call?
I've spent the last couple of days banging my head against the wall but
keep getting an error of 2695 (The specified workgroup name is invalid)
I just want to change the workgroup name, my code below....
Function JoinWorkGroup(sNewWorkgroupName:string): Boolean;
type
Type_NetJoinDomain = function(lpServer, lpDomain, lpAccountOU,
lpAccount, lpPassword: LPCWSTR; fJoinOptions: DWORD): integer;
var
lngResultCode : LongInt;
iResultCode : Integer;
_NetJoinDomain :
Type_NetJoinDomain;
lpNewWorkgroupName : LPCWSTR;
begin
GetMem(lpNewWorkgroupName,Length(sNewWorkgroupName)*2+1);
stringtowidechar(sNewWorkgroupName,lpNewWorkgroupName,Length(sNewWorkgroupName)*2+1);
JoinWorkGroup:=False;
Try
iResultCode:=LoadLibrary(pchar('NetAPI32.dll'));
@_NetJoinDomain:=GetProcAddress(iResultCode,pchar('NetJoinDomain'));
lngResultCode:=
_NetJoinDomain('',lpNewWorkgroupName,'','','',0);
FreeLibrary(iResultCode);
Finally
end;
if lngResultCode = 0 then
JoinWorkGroup:=TRUE
else
ShowMessage(inttostr(lngResultCode));
end;
Thanks and regards,
David
|
|
| Back to top |
|
 |
Riki Wiki Google Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|