Thread View: microsoft.public.vc.language
2 messages
2 total messages
Started by Slick
Wed, 12 Nov 1997 00:00
Need an API function to check for/map network drive under Win32
Author: Slick
Date: Wed, 12 Nov 1997 00:00
Date: Wed, 12 Nov 1997 00:00
12 lines
1219 bytes
1219 bytes
Client has two PCs in a Win95 peer network using Netbui. The computers always "see" each other, but sometimes the drive mappings go haywire. I need a way to check for an active connection to a remote drive, and a way to connect to said drive if the connection is broken. (An API function to map the drive would be sufficient, I could just map it every time.) Please email any responses,and thanx in advance! slick@novagate.net Key fingerprint = D3 D2 32 2C 28 B9 0B 05 A4 0B C5 5E 20 FE D7 C6
Re: Need an API function to check for/map network drive under Win32
Author: David Davidson
Date: Mon, 17 Nov 1997 00:00
Date: Mon, 17 Nov 1997 00:00
37 lines
1797 bytes
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)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads