Re: network path and use of netsharecheck api....
From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 08/04/04
- Next message: mr unreliable: "thanks for the advice"
- Previous message: mr unreliable: "thanks for the code..."
- In reply to: N|O: "network path and use of netsharecheck api...."
- Next in thread: N|O: "Re: network path and use of netsharecheck api...."
- Reply: N|O: "Re: network path and use of netsharecheck api...."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 4 Aug 2004 15:10:13 -0400
This appears to work:
Private Declare Function NetShareCheck Lib "netapi32.dll" _
(servername As Byte, _
device As Byte, _
sharetype As Long) As Long
Private Sub Command1_Click()
Dim sharetype As Long
Dim success As Long
Dim bServer() As Byte
Dim bShare() As Byte
bServer() = "\\laptopxp" ' -->\\server name
bShare() = "C:\windows\cursors" ' -->folder to find
success = NetShareCheck(bServer(0), bShare(0), sharetype)
Print success & " " & sharetype
End Sub
I have noticed however that the full path to the folder on the remote
machine must be specified, and the drive letter must be upper case. The
correct results seem to be reliably returned if you ucase the entire string,
e.g. bShare() = UCase$("C:\windows\Cursors").
-- Randy Birch MVP Visual Basic http://vbnet.mvps.org/ Please respond only to the newsgroups so all can benefit. "N|O" <foolish3@hotmail.com> wrote in message news:vI6Qc.96043$5D1.4929867@news4.tin.it... : hii, i have to know if a folder, situated in \\server\images (for example) : exists. : : This is the vb code i use: : : Private Declare Function NetShareCheck Lib "netapi32.dll" _ : (ByVal ServerName As String, _ : ByVal Device As String, _ : ByRef ShareType As Long) As Long : : : Private Sub Command1_Click() : Dim SName As String : Dim SHName As String : Dim DevType As Long : Dim Ans As Long : : SName = Text1.Text -->\\server name : SHName = Text2.Text -->folder to find : DevType = -1 : : Ans = NetShareCheck(StrConv(SName, vbUnicode), StrConv(UCase(SHName), : vbUnicode), DevType) : MsgBox Ans, , DevType : End Sub : : devtype return is 0, i think maybe the server exist, but Ans return : 2311...this means: NetShareCheck fails with error 2311 : (NERR_DeviceNotShared) when remoted to OS/2. : : How can i resolve this? : Thakns a lot : :
- Next message: mr unreliable: "thanks for the advice"
- Previous message: mr unreliable: "thanks for the code..."
- In reply to: N|O: "network path and use of netsharecheck api...."
- Next in thread: N|O: "Re: network path and use of netsharecheck api...."
- Reply: N|O: "Re: network path and use of netsharecheck api...."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|