🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: microsoft.public.vc.language
Article #17

Re: Need an API function to check for/map network drive under Win32

#17
From: David Davidson
Date: Mon, 17 Nov 1997 00:00
37 lines
1797 bytes
Here's code to map a drive:

Private Type NETRESOURCE
        dwScope As Long
        dwType As Long
        dwDisplayType As Long
        dwUsage As Long
        lpLocalName As String
        lpRemoteName As String
        lpComment As String
        lpProvider As String
End Type

Private Declare Function WNetAddConnection2 Lib "mpr.dll" Alias
"WNetAddConnection2A" (lpNetResource As NETRESOURCE, ByVal lpPassword As
String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long

------------------

Here's a sample to map \\DavidsonD\win95 to N:

------------------

Const RESOURCETYPE_DISK = &H1
Const DEFAULT_CONNECT_DRIVE = "N:"

Dim NetworkConnection As NETRESOURCE
Dim NetworkPassword As String
Dim result as Long

UNCPath = "\\DavidsonD\win95"
NetworkPassword = "password"
NetworkConnection.dwType = RESOURCETYPE_DISK
NetworkConnection.lpLocalName = DEFAULT_CONNECT_DRIVE
NetworkConnection.lpRemoteName = UNCPath
result = WNetAddConnection2(NetworkConnection, NetworkPassword, "", 0)
Technical Details
Message-ID: <01bcf07e$7667f040$c4631b8a@Davidsond>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <64bpub$91h$1@205.138.136.79>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1091e5,b3be10dafd5997cc
X-Google-Attributes: gid1091e5,public
X-Google-Thread: 104093,b3be10dafd5997cc
X-Google-Attributes: gid104093,public
X-Google-Thread: 103bde,b3be10dafd5997cc
X-Google-Attributes: gid103bde,public
X-Google-Thread: f7a51,b3be10dafd5997cc
X-Google-Attributes: gidf7a51,public
From: "David Davidson" <DavidsonD@huachuca-emh1.army.mil>
Subject: Re: Need an API function to check for/map network drive under Win32
Date: 1997/11/17
Message-ID: <01bcf07e$7667f040$c4631b8a@Davidsond>
X-Deja-AN: 290250239
References: <64bpub$91h$1@205.138.136.79>
Newsgroups: microsoft.public.vc.language,microsoft.public.vb.winapi,borland.public.cpp.winapi,borland.public.delphi.winapi