Hi..

I would like to use microsoft visual studio C++ 6.0 to build a execute file to detect whether network drive is connected and ready to used..
can anyone of you teach me how do I do this..??

my situation is I have 2 PC connect using LAN..
PC A create a folder and share out..
PC B map drive so that my software can access content of folder from PC A..
if I do not double click that mapping drive from PC B, my software will fail to access
folder from PC A..
so I do setting at startup there..after I on PC B, will auto connect and open mapping
drive from PC A..
but sometimes, user on PC B before PC A..once again, my software fail to access that
mapping drive which from PC A again..

so I would like to write a program to detect whether mapping drive is ready to use (PC A is on).. and
execute that mapping drive so that my software able to access content of the mapping
drive..

Please advise..

Thank you..
shizu..

Recommended Answers

All 3 Replies

Can you run program on PC A ?
Or, you only want to run program on PC B ?

Member Avatar for imlayt

For these situations, I use the UNC path (\\servername\sharename) instead of a mapped drive.

This has two big advantages over a mapped drive:
1. It doesn't depend on the user mapping the share to a particular drive letter. (I've had problems in the past where the user had mapped some other share to the drive letter I had planned to use.)
2. It doesn't require that the share be connected before being accessed.

Using the UNC path has made accessing file shares transparent to users of my applications. Hope it will work for you as well.

If you know the drive letter that the shared drive is on, then you could use GetVolumeInformation after checking the drive letter with GetDriveType.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.