调试VB6应用程序时如何设置工作目录? [英] How to set working directory when debugging VB6 app?

查看:36
本文介绍了调试VB6应用程序时如何设置工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试 VB6 可执行文件.可执行文件在运行时从其当前目录加载 dll 和文件.在调试器中运行时,当前目录似乎是 VB6 的目录.

I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir.

如何为 VB6 设置工作目录?

How do I set working directory for VB6?

推荐答案

对于这件事,它似乎不是开箱即用"的解决方案.

It doesn't seems to be a "out of the box" solution for this thing.

取自 The Old Joel On Software Forums

无论如何..让这个话题休息..以下是我的 VB6 解决方案:我在我的 VB 项目中定义 2 个符号"MPDEBUG" 和 "MPRELEASE" 并调用以下功能作为第一个在我的应用程序入口点操作功能.

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

这篇关于调试VB6应用程序时如何设置工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆