App.Path Might Return UNC Path Specifications

Unlike VB4, VB5””””s App.Path property might return a UNC path, such as “\serverprograms…”), undercertain circumstances, depending on how the program started and if it””””s interpreted in the VB IDE orcompiled as a standalone EXE. This change likely affects all applications that use App.Path to set the currentdirectory when the program starts:

 ChDrive App.PathChDir App.Path

In fact, because ChDrive cannot handle UNC paths, the code might raise a fatal runtime error, and shouldbe protected using an On Error Resume Next statement. This fix, however, doesn””””t protect you under everypossible condition. The best approach is to give the end user the capability to set the application directory atrun time, then save the entered value in the registry or in an INI file. For more information on this problemand its possible solutions, see article Q167167 in the Microsoft Knowledge Base.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: