Return Drive Letter or UNC Drive Spec Given a Path

Category:
Network/Internet
Type:
Snippets
Difficulty:
Beginning
Author:
Gavin Bollard

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This function is used when you want to know the root directory of your current drive, but don't know if it is mapped or not. It is ideal for usage on AutoRun CD Programs because otherwise they often fail if run over a network. Its better than simply doing a LEFT$(App.path,2) because on a UNC name this would simply return \\

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: