调试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

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...