Fritz
Freshman
I am creating a share for my app-folder:
Imports System.Management
On BTN_CLICK:
Dim apath As String = IO.Directory.GetCurrentDirectory()
'Const IsFileShare As Integer = 0
'Const Max_Connections As Integer = 10
Dim Share_Info As String() = {apath, "MyApp", 0}
Dim Win_Shares As ManagementClass = New ManagementClass("Win32_Share")
Try
Win_Shares.InvokeMethod("Create", Share_Info)
Catch ex As System.Management.ManagementException
MessageBox.Show(ex.ToString)
Return
Finally
Win_Shares.Dispose()
End Try
MessageBox.Show("Share: " + Share_Info(0) + " succeed!")
This works fine for W2000/XP. It also creates a share on Win98/Me, but ReadOnly. And of course like that the App will not run on client machines.
I have also tried with API's, all kind of stuff, also with VB6 code, but the code above still works best, except for this silly little detail, and I cannot find a way to change the ReadOnly-mode to ReadWrite.
Anybody got an idea?
Fritz
Imports System.Management
On BTN_CLICK:
Dim apath As String = IO.Directory.GetCurrentDirectory()
'Const IsFileShare As Integer = 0
'Const Max_Connections As Integer = 10
Dim Share_Info As String() = {apath, "MyApp", 0}
Dim Win_Shares As ManagementClass = New ManagementClass("Win32_Share")
Try
Win_Shares.InvokeMethod("Create", Share_Info)
Catch ex As System.Management.ManagementException
MessageBox.Show(ex.ToString)
Return
Finally
Win_Shares.Dispose()
End Try
MessageBox.Show("Share: " + Share_Info(0) + " succeed!")
This works fine for W2000/XP. It also creates a share on Win98/Me, but ReadOnly. And of course like that the App will not run on client machines.
I have also tried with API's, all kind of stuff, also with VB6 code, but the code above still works best, except for this silly little detail, and I cannot find a way to change the ReadOnly-mode to ReadWrite.
Anybody got an idea?
Fritz