13
A
回答
10
这并不似乎是为这件事了“开箱即用”的解决方案。
从The Old Joel On Software Forums
不管怎么说采取..把这个话题休息.. 以下是我的VB6解决办法:我 在我的VB项目中定义2个符号 “MPDEBUG”和“MPRELEASE”和在我的应用程序入口点 函数中调用 以下函数作为第一个 操作。我发现,工作
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
2
'Declaration
Private Declare Function SetCurrentDirectory Lib "kernel32" _
Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long
'syntax to set current dir
SetCurrentDirectory App.Path
6
解决方案使用Sub Main
,并检查程序在IDE中运行。
Dim gISIDE as Boolean
Sub Main()
If IsIDE Then
ChDrive App.Path
ChDir App.Path
End If
' The rest of the code goes here...
End Sub
Public Function IsIDE() As Boolean '
IsIDE = False
'This line is only executed if running in the IDE and then returns True
Debug.Assert CheckIDE
If gISIDE Then
IsIDE = True
End If
End Function
Private Function CheckIDE() As Boolean ' this is a helper function for Public Function IsIDE()
gISIDE = True 'set global flag
CheckIDE = True
End Function
6
“当前目录似乎是VB6的目录”只有当你打开使用文件 - 打开一个项目。
在IDE关闭时双击.vbp文件打开它。
1
可以在快捷方式的属性中更改任何程序的当前目录(包括vb6)。我已经将它更改为我的源代码树的根目录,它使得使用File-Open更快。
相关问题
- 1. 如何获取/设置winforms应用程序的工作目录?
- 2. 如何为Java应用程序设置工作目录?
- 3. VSCode - 如何设置调试工作目录
- 4. Mac上的Monodevelop如何设置调试的工作目录
- 5. 试图设置Django应用程序子目录作为子域
- 6. 如何使用VB6找到应用程序所在的目录?
- 7. VB6,设置radioobox值调用RadioButton_Click程序
- 8. GNU并行:如何在使用“--nonall”时设置工作目录?
- 9. 如何调试从另一个应用程序启动的应用程序? (VB6)
- 10. 如何在Heroku:Python应用程序中设置node_modules目录?
- 11. IIS - 如何在子目录中设置独立应用程序?
- 12. 我该如何设置从我的Java应用程序启动的MacOS应用程序包的工作目录?
- 13. 在Rails应用程序目录之外设置公共目录
- 14. vscode工作目录时调试python
- 15. 在设备上调试android应用程序不会工作
- 16. 如何在Visual Studio中调试时更改工作目录?
- 17. 应用程序工作目录(VB.NET)
- 18. 如何设置WinGHCi的工作目录
- 19. 如何设置当前工作目录?
- 20. 如何设置eclipse RCP应用程序的远程调试
- 21. 如何为Asp.Net应用程序从头设置远程调试
- 22. 如何使用wxWidgets在UI中设置项目工作目录?
- 23. 如何在winform应用程序调用服务时设置cookie
- 24. 如何正确设置用于调试的Silverlight应用程序?
- 25. 如何在应用程序中设置目标路径两次(程序应用程序和数据目录)
- 26. 如何在应用程序打开时更改应用程序设置(设置)?
- 27. JQuery应用程序只能在IE中工作时调试
- 28. 通用Windows应用程序调试设备不工作
- 29. 如何退出VB6应用程序并设置退出代码
- 30. VB6:的CreateFile()在当前工作目录
但使用本机VB6命令`ChDrive App.Path:ChDir App.Path`更简单 – MarkJ 2011-12-15 16:11:15