调试VB6应用程序时如何设置工作目录?

前端之家收集整理的这篇文章主要介绍了调试VB6应用程序时如何设置工作目录?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在调试一个VB6可执行文件.运行时,可执行文件会从当前目录载入dll和文件.当在调试器中运行时,当前目录似乎是VB6的目录.

如何设置VB6的工作目录?

这似乎并不是一个“开箱即用”的解决方案.

取自The Old Joel On Software Forums

Anyways.. to put this topic to rest..
the following was my VB6 solution: I
define 2 symbols in my VB project
“MPDEBUG” and “MPRELEASE” and call the
following function as the first
operation in my apps entry point
function.

Public Sub ChangeDirToApp()
#If MPDEBUG = 0 And MPRELEASE = 1 Then
  ' assume that in final release builds the current dir will be the location
  ' of where the .exe was installed; paths are relative to the install dir
  ChDrive App.path
  ChDir App.path
#Else
  ' in all debug/IDE related builds,we need to switch to the "bin" dir
  ChDrive App.path
  ChDir App.path & BackSlash(App.path) & "..\bin"
#End If
End Sub

猜你在找的VB相关文章