Re: network path and use of netsharecheck api....

From: N|O (foolish3_at_hotmail.com)
Date: 08/05/04


Date: Thu, 05 Aug 2004 00:22:25 GMT

OK, thanks, now it work, but another problem is come out.....ìf server needs
an user n pass to allowe to the client to visualize the path? In this type
of situation this program give me this error: 5....couse i was not
autenticate before....if i autenticate myself, all work...how can i bypass
this problem?

"Randy Birch" <rgb_removethis@mvps.org> ha scritto nel messaggio
news:elsLtaleEHA.596@TK2MSFTNGP11.phx.gbl...
> 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
> :
> :
>



Relevant Pages

  • Project Error
    ... Private Declare Sub Sleep Lib "Kernel32" ... Dim strDataSrc As String ...
    (microsoft.public.vb.bugs)
  • Re: Is there a way to prevent a RichTextBox from scrolling?
    ... Private _isRegex As Boolean ... Public Sub New(ByVal thispattern As String, ... Dim entry As tDict ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Excel Listing tool using VB
    ... Sub ListFiles2() ... Dim directories() As String, CurrentDirectory As String ... Dim dirtopaste, dirok ...
    (microsoft.public.vb.general.discussion)
  • Form Error
    ... SMSDS_CallerID As String ... Private Declare Sub Sleep Lib "kernel32" ... Dim ComString As String ... Dim AppPath As String, FreeFileNo% ...
    (microsoft.public.vb.bugs)
  • Re: Encrypt/hide Password
    ... Public Sub New(ByVal strCryptoName As String) ... ' instantiated crypto class. ... Dim fsKey As New FileStream(strSaveToPath, FileMode.OpenOrCreate, _ ...
    (microsoft.public.scripting.wsh)