locked
Accessing AppDAta

    Question

  • Is there a way to obtain the  store app's local data path from a Win32 DLL ? Will shgetfolderpath work here ?

    MSDN article says these could be referenced from Win32/COM.

    Thanks !!

    Monday, February 17, 2014 2:03 PM

Answers

All replies

  • You need to call the Windows Runtime app data classes to get the app's data folder. It is not available from SHGetFolderPath, and SHGetFolderPath cannot be called in a Windows Store app.

    See Managing app data

    Win32 libraries used in Windows Store apps can call only the parts of Win32 which are available to Windows Store apps. Win32 DLLs can call the Windows Runtime via COM, but it is more difficult than doing so with C++/Cx

    A good alternative is to open the file from the C++/Cx module and then pass a stream to the DLL. For the app data directories you can pass the path to the DLL, since the app has direct access rights to the app data. The path won't work for other folders where the app doesn't have access.

    --Rob

    Monday, February 17, 2014 3:41 PM
    Moderator
  • Thanks Rob.I resorted to sending across the path as a parameter to DLL.

    "Win32 DLLs can call the Windows Runtime via COM, but it is more difficult than doing so with C++/Cx"

    Are there any samples instructing how to achieve the quoted one ?

    Tuesday, February 18, 2014 2:44 AM
  • Take a look at the Windows Runtime Component using WRL . It's not quite what you are doing, but will get you close. Passing the path (or more generally a stream) in is probably a better solution.

    --Rob

    Tuesday, February 18, 2014 2:55 AM
    Moderator