locked
Metro App call Win32 API(GetDiskFreeSpaceEx)

    Question

  • Dear Sir,

    I create a Metro App, to call GetDiskFreeSpaceEx Win32 API, but return "0". 

    MSDN say "The subset of the Win32 and COM API that can be used in a Metro style app is indicated in the header files", it's include.

    Please help me, thanks!


    Wednesday, December 7, 2011 10:57 AM

Answers

  • How are you calling GetDiskFreeSpaceEx and what does GetLastError() report?  I suspect you're calling GetDiskFreeSpaceEx on a directory you don't have access to and failing with ERROR_ACCESS_DENIED.

    Metro style apps do not have access to most of the file system and will only be able to call this on their local data store and install directory.

    --Rob

    Thursday, December 8, 2011 3:23 AM
    Owner

All replies

  • Hey ONIIONIION,

     

    What language are you using the create your Metro style application?


    Steven
    Wednesday, December 7, 2011 6:10 PM
  • Dear Steven,

    Thank for your reply, I'm using C++. 

    Thursday, December 8, 2011 2:46 AM
  • Hello ONIIONIION,

     

    This thread was created in the Windows Developer Preview: General OS forum; the Microsoft Moderation team has moved this thread to the Building Metro style apps with C++ forum for further assistance.


    Steven
    Thursday, December 8, 2011 2:50 AM
  • How are you calling GetDiskFreeSpaceEx and what does GetLastError() report?  I suspect you're calling GetDiskFreeSpaceEx on a directory you don't have access to and failing with ERROR_ACCESS_DENIED.

    Metro style apps do not have access to most of the file system and will only be able to call this on their local data store and install directory.

    --Rob

    Thursday, December 8, 2011 3:23 AM
    Owner
  • Dear Steven & Rob,

    Thank for your reply.

     

    Hello Rob,

    Thanks! The problem is fix. The path set to "." or "install directory". 

    Then if i want to get disk drive information(like: GetLogicalDrives, GetLogicalDriveStrings, GetVolumeInformation...).

    What can i do? 

    Thursday, December 8, 2011 6:38 AM
  • Those Win32 APIs are not available. Maybe it will help us if we understood what are you trying to accomplish. You only have access to the app's install and Application data folders with the Win32 APIs so you couldn't write to other volumes using them even if you discovered other volumes existed.

     

    Thanks,

    -David


    Thursday, December 8, 2011 11:49 PM
    Moderator
  • Dear David,

    Thank for your reply.

    Friday, December 9, 2011 10:23 AM