How to Change App.Path in VB6

Save

The "App.Path" notation in Visual Basic 6 (VB6) sets the current application's active path. The App.Path function is shorthand notation that identifies the location of all the custom software's executable files. You change the App.Path location using the "SetCurrentDirectory" Windows function. This function sets the active directory to the specified location, so you can change the focus of the application's working directory.

  • Click the Windows "Start" button and select "All Programs." Click "Microsoft Visual Basic" program group, then click "Visual Basic 6" to open the compiler software.

  • Click the "File" menu item in the VB6 software, then click "Open." Double-click your VB6 project file to load all of your designed forms and code files.

  • Double-click the code file you want to use to edit the App.Path location. Copy and paste the following code to the top of your code file:

    Private Declare Function SetCurrentDirectory Lib "kernel32" _

    Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long

    The code above inserts the Windows kernel library into the file, which provides you with the "SetCurrentDirectory" function.

  • Scroll down the file to the place in the code you want to change the App.Path. Type the following code to change the directory:

    SetCurrentDirectory("c:\newpath\")

    Replace "C:\newpath\" with your own directory.

References

Promoted By Zergnet

Comments

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!