Can't find ProgramData folder for windows.



  • Greetings,

    I want to locate a ProgramData (or C:\Documents and Settings\All Users\Application Data). I'm using QStandardPaths class. I tried a bunch of different StandardLocations. But I always have C:/Users/myuser/... folder, i.e. not public folder. Currently I'm using windows API for that, but maybe I'm just doing something wrong.

    Qt 5.4.0, Win7.



  • Some of these functions should return more than one item. Does none of them contain the path you need?



  • That's right, no one.



  • Hi, I also tried Qt for that directory, but alas, you have to venture into the bowels of Windows:
    @
    #include "shlobj.h"
    @

    then:
    @
    TCHAR szPath[MAX_PATH];
    SHGetFolderPath(NULL,CSIDL_COMMON_APPDATA,NULL,0,szPath);
    QString sCommonAppData = QString::fromWCharArray(szPath);
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.