Dan Appelman's network APIs 
Author Message
 Dan Appelman's network APIs

Hi,
Is there anyone familiar with Dan Appelman's dwNetwork class and
WNetGetUniversalName in particular?

Following extract from my program concerning UNC works fine on NT network
with NT and W98 workstations. But for W95 workstation it always fails with
.LastError= 1200 (...BAD_DEVICE)
Below double line is a code, which I called "pure API". Unfortunately it
accepts only a drive letter (I really need full path) but it returns a
correct UNC for passed drive for the same W95 workstation. What can be wrong
and/or specific for W95?

Dim objNet As New dwNetwork
Dim objRemoteName As New dwRemoteNameInfo
Const sprocName = vbCrLf & "(:GetUNC)"

    Set objRemoteName =
objNet.WNetGetUniversalName(sSourcePath,REMOTE_NAME_INFO_LEVEL)
    With objRemoteName
        sUniversalName = .lpUniversalName
        sConnectionName = .lpConnectionName
        sRemainingPath = .lpRemainingPath
    End With
    With objNet
        If .LastError <> 0 Then
    MsgBox "Network Error: " & .LastError & sprocName,vbInformation,
frm.Caption
End if
    End With '/*objNet*/

Exit_Procedure:
    Set objNet = Nothing
    Set objRemoteName = Nothing
    Exit Function
========================================
==="pure API"===========================
Public Function GetUNCPath(strDriveLetter As String) As String
dim lngReturn as Long
Dim lpszLocalName As String
Dim lpszRemoteName As String
Dim lRemoteName As Long

   lpszLocalName = strDriveLetter
   lpszRemoteName = String$(255, Chr$(32))
   lRemoteName = Len(lpszRemoteName)
   lngReturn =WNetGetConnection(lpszLocalName,lpszRemoteName,lRemoteName)
   GetUNCPath = Left$(lpszRemoteName, lRemoteName)

Thanks for your time
Regards
Cat



Sat, 14 Apr 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Dan Appelman's network APIs

2. VB 5.0 p guide 2 the win32 api (dan appelman)

3. Looking: Dan Appleman's Visual Basic 5.0 Programmer's Guide To The Win32 API

4. Dan Appleman's VB5 Programmer's Guide to the Win32 API

5. Dan Appleman's VB5 Programmer's Guide to the Win32 API

6. ! The answer to all your API questions: VB5 Guide to API - Dan Appleman

7. ! The answer to all your API questions: VB5 Guide to API - Dan Appleman

8. ! The answer to all your API questions: VB5 Guide to API - Dan Appleman

9. ! The answer to all your API questions: VB5 Guide to API - Dan Appleman

10. need Dan Appleman Book of API

11. ! Dan Applemans excellant Win32 API book.

 

 
Powered by phpBB® Forum Software