基本上和这个问题一样,但是对于VB6。
客户的应用程序"AppName“将其配置文件存储在CommonAppData中。
如何使用VB6?获得正确的民谣名称?
其他注意事项,我更喜欢使用API调用,而不是添加对prefer 32.dll的引用
发布于 2010-06-19 00:28:47
使用后期装订:
Const ssfCOMMONAPPDATA = &H23
Dim strCommonAppData As String
strCommonAppData = _
CreateObject("Shell.Application").NameSpace(ssfCOMMONAPPDATA).Self.Path发布于 2010-06-16 18:06:37
找到了它;
Private Declare Function SHGetFolderPath _
Lib "shfolder.dll" Alias "SHGetFolderPathA" _
(ByVal hwndOwner As Long, _
ByVal nFolder As Long, _
ByVal hToken As Long, _
ByVal dwReserved As Long, _
ByVal lpszPath As String) As Long
Private Const CSIDL_COMMON_APPDATA = &H23
Private Const CSIDL_COMMON_DOCUMENTS = &H2E
Public Function strGetCommonAppDataPath() As String
Dim strPath As String
strPath = Space$(512)
Call SHGetFolderPath(0, CSIDL_COMMON_APPDATA, 0, 0, strPath)
strPath = Left$(strPath, InStr(strPath, vbNullChar))
strGetCommonAppDataPath = strPath
End Function发布于 2010-06-17 18:04:51
卡尔·彼得森( Karl )有一个名为已发布的VB6类,名为CSystemFolders,它可以找到CSIDL_APPDATA、CSIDL_LOCAL_APPDATA和CSIDL_COMMON_APPDATA。
卡尔的代码总是可靠的,不接受替代:)
https://stackoverflow.com/questions/3054802
复制相似问题