Johnjces
asked on
Using NetShareDel. I can't make it work!
I am using NetShareDel and declaring it as:
function NetShareDel(ServerName, ShareName : PChar; level:DWord) : DWord; stdcall; external 'NETAPI32.DLL';
I create a share and call it "Test" and then do a simple button click...
procedure TForm1.Button4Click(Sender : TObject);
begin
NetShareDel(nil, pChar('GuestGate'), 0);
end;
... to unshare the "Test" shared folder.
It does not unshare the folder.
What have I done/am doing wrong! I can use NetShareAdd just fine, but something's amiss here and I am brain dead!
Thanks!
John
function NetShareDel(ServerName, ShareName : PChar; level:DWord) : DWord; stdcall; external 'NETAPI32.DLL';
I create a share and call it "Test" and then do a simple button click...
procedure TForm1.Button4Click(Sender
begin
NetShareDel(nil, pChar('GuestGate'), 0);
end;
... to unshare the "Test" shared folder.
It does not unshare the folder.
What have I done/am doing wrong! I can use NetShareAdd just fine, but something's amiss here and I am brain dead!
Thanks!
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got me to the right place. Thanks!
ASKER
THANKS!
Summation for others:
function NetShareDel(ServerName, ShareName : pwChar; level:DWord) : DWord; stdcall; external 'NETAPI32.DLL';
procedure TForm1.Button1Click(Sender
var
NameNT : PWChar;
Size : Integer;
begin
Size := SizeOf(WideChar)*256;
GetMem(NameNT,Size);
StringToWideChar('Test',Na
NetShareDel(nil,NameNT,0);
end;
John