Need an API function to check for/map network drive under Win32 
Author Message
 Need an API function to check for/map network drive under Win32

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!

 Key fingerprint =  D3 D2 32 2C 28 B9 0B 05  A4 0B C5 5E 20 FE D7 C6



Sun, 30 Apr 2000 03:00:00 GMT  
 Need an API function to check for/map network drive under Win32

Networking questions like this should really be posted in the
microsoft.public.win32.programmer.network

However to map a network drive you would use the WNetAddConnection (or
WNetAddConnection2 or WNetAddConnection3  depending on what options you
need)

--
I have no beliefs....
  I believe I'm a walking contradiction....
 ---------------------------------------------------------------------------
---
| Author for Pinnacle Publishing "Visual C++ Developer"
http://www.pinpub.com/ |
| http://lucifer.lotus.com/jim/main.htm
|
 ---------------------------------------------------------------------------
---



Mon, 01 May 2000 03:00:00 GMT  
 Need an API function to check for/map network drive under Win32

Thanx for the info, and I'll subscribe to yet another newsgroup ASAP!

On Thu, 13 Nov 1997 11:39:17 -0500, "Jim Marshall"

Quote:
>Networking questions like this should really be posted in the
>microsoft.public.win32.programmer.network

>However to map a network drive you would use the WNetAddConnection (or
>WNetAddConnection2 or WNetAddConnection3  depending on what options you
>need)

>--
>I have no beliefs....
>  I believe I'm a walking contradiction....
> ---------------------------------------------------------------------------
>---
>| Author for Pinnacle Publishing "Visual C++ Developer"
>http://www.pinpub.com/ |
>| http://lucifer.lotus.com/jim/main.htm
>|
> ---------------------------------------------------------------------------
>---


 Key fingerprint =  D3 D2 32 2C 28 B9 0B 05  A4 0B C5 5E 20 FE D7 C6



Mon, 01 May 2000 03:00:00 GMT  
 Need an API function to check for/map network drive under Win32

Call WNetGetConnection() API to check if some local drives are connected
to  network resources.
To map a network resource to a local drive call WNetAddConnection() or
WNetAddConnection2() API.

Regards,
         Stoil

Quote:

> 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!

>  Key fingerprint =  D3 D2 32 2C 28 B9 0B 05  A4 0B C5 5E 20 FE D7 C6



Mon, 01 May 2000 03:00:00 GMT  
 Need an API function to check for/map network drive under Win32

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)



Fri, 05 May 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. get drive size from network network mapped drives

2. Map Network Drive - API call?

3. API for mapping a network drive

4. API (What is the network mapped drive?)

5. Win95 API for mapping network drives ?

6. API for Network Drive Mapping

7. rename a drive / map network drive

8. I need a help file with a detailed description of Win32 API functions

9. API needed to check if network is runnin

10. API needed to check if network is running.

11. Win API functions that don't seem to exist in Win32 API

12. check for mapped drive after dial-up

 

 
Powered by phpBB® Forum Software