我利用SHGetSpecialFolderLocation和SHGetPathFromIDList函数获取“启动”文件夹路径,成功了,但只是获取当前用户的文件夹路径,如果我想获取所有用户(All Users)的文件夹路径呢?请大家指教。谢谢!

解决方案 »

  1.   

    用replace语句替换当前用户名为“All Users”不就得了?
      

  2.   

    Private Sub Command1_Click()
        Dim strPath As String             '这里假设strPath里存放着你取到的文件夹路径
        strPath = "C:\Documents and Settings\All Users\「开始」菜单\程序\启动"
        strPath = Replace(strPath, "All Users", Environ("username"))
    End Sub
    'Environ("username")返回当前用户名
      

  3.   

    或者读取注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell FoldersCommon Startup