bonjour,
Je cherche a faire un repertoire partagé en vb.
Y aurait il une fonction en .net car je recherche depuis quelque temps mais c'est le désert:cry:
quelqu'un aurait une idée ?
Merci d'avance
Version imprimable
bonjour,
Je cherche a faire un repertoire partagé en vb.
Y aurait il une fonction en .net car je recherche depuis quelque temps mais c'est le désert:cry:
quelqu'un aurait une idée ?
Merci d'avance
pas en .net, il faut surement utiliser une api, ou jeter un oeil sur wmi, et encore pas sur que ca se trouve ...
Merci pour votre réponse mais j'avais un gros doute.:roll:
en attandant mieu je vais utiliser Win32_Share.
J'ai trouver un bout de code qui vas me rendre service.
Dans le cas ou quelqu'un trouve une autre solution, je suis preneur.
pour info :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 Imports System Imports System.IO Imports System.Management Public Class Form1 Private Declare Function SHChangeNotify Lib "Shell32.dll" (ByVal wEventID As Int32, ByVal uFlags As Int32, ByVal dwItem1 As Int32, ByVal dwItem2 As Int32) As Int32 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If FolderBrowserDialog1.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then Try Dim managementClass As New ManagementClass("Win32_Share") Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create") inParams("Description") = "My Description" inParams("Name") = "nom d'affichage du repertoire partagé" inParams("Path") = FolderBrowserDialog1.SelectedPath inParams("Type") = &H0 inParams("MaximumAllowed") = Nothing ' Set unlimited number of users connected, or specify a positive integer. inParams("Password") = Nothing inParams("Access") = Nothing ' Make Everyone has full control access. Dim outParams As ManagementBaseObject = managementClass.InvokeMethod("Create", inParams, Nothing) If Convert.ToUInt32(outParams.Properties("ReturnValue").Value) <> 0 Then MessageBox.Show("Unable to share directory.") Else MessageBox.Show("Shared folder successfully!") End If SHChangeNotify(&H8000000, &H0, 0, 0) inParams.Dispose() managementClass.Dispose() Catch ex As Exception MessageBox.Show(ex.Message) End Try End If End Sub END CLASS