[DllImport("Netapi32.dll")]
public static extern int NetShareAdd(
[MarshalAs(UnmanagedType.LPWStr)] string strServer,
Int32 dwLevel,
IntPtr buf,
IntPtr parm_err
);
Declare Unicode Function NetShareAdd Lib "netapi32.dll" _
(ByVal servername As String, _
ByVal level As Integer, _
ByRef buf As SHARE_INFO_2, _
ByRef parm_err As Integer) As Integer
None.
[2004-06-11]
VB Def and Sample code added by RACKLEY
Please add some!
Dim shi2 As SHARE_INFO_2
' Populate the structure with information
shi2.shi2_netname = sharename" ' share name
shi2.shi2_type = STYPE_DISKTREE ' disk drive
shi2.shi2_remark = "" ' share comment
shi2.shi2_permissions = 0
shi2.shi2_max_uses = -1 ' unlimited
shi2.shi2_current_uses = 0
shi2.shi2_path = "c:\myshare"
shi2.shi2_passwd = Nothing ' no password
retval = NetShareAdd(ServerName, 2, shi2, Nothing)
Do you know one? Please contribute it!