VB CURDIR$ Function Not Reliable to Determine Program Location

ID Number: Q80611

1.00

WINDOWS

Summary:

The CURDIR$ function returns the path to the current directory on the

currently selected drive. Because the current directory is not

necessarily the directory where the current Visual Basic program

resides, the CURDIR$ function is not a reliable means for determining

the location of the currently executing program. This information

applies to the CURDIR$ function, and to the drive list box, directory

list box, and file list box controls in Visual Basic.

This information applies to Microsoft Visual Basic programming system

version 1.0 for Windows.

More Information:

You can use any of the following methods to start a program under

Windows:

- From the MS-DOS prompt, type:

WIN drive:\pathname\program name

- From Windows Program Manager, choose Run from the File menu, and

enter the full pathname of the executable program.

- From Windows File Manager, choose Run from the File menu, and

enter the full path of the executable program.

- From Windows Program Manager, choose New from the File menu, and

create a new program item for the executable program. Double-

click on the resulting icon.

- From Windows File Manager, use the mouse to choose the appropriate

drive and directory containing the executable file, and double-click

the executable filename.

If the program is launched using the first, third, or fifth method

above, the CURDIR$ value will return the current directory at the time

Windows was launched or at the time the program was started from File

Manager (the current directory can be checked by opening File Manager

and reading the current directory from the bar below the drive

buttons; for the fifth method, the File Manager's current directory

will actually be the directory where the started program resides).

If the program is launched using the second or fourth method above

(from the Windows Program Manager), the CURDIR$ value will be the path

to the location of the program that was started.

Note that the current directory of an MS-DOS session does not

necessarily indicate the current directory that will be returned by

CURDIR$.

Additional reference words: 1.00