BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help to make NetJoinDomain API call

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WinAPI
View previous topic :: View next topic  
Author Message
David
Guest





PostPosted: Sat Aug 06, 2005 12:01 pm    Post subject: Need help to make NetJoinDomain API call Reply with quote



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





PostPosted: Fri Aug 12, 2005 1:06 am    Post subject: Re: Need help to make NetJoinDomain API call Reply with quote



David wrote:
Quote:
I've spent the last couple of days banging my head against the wall

Take a look here:
http://delphi.wikicities.com/wiki/Delphi_Newsgroups


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.