/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a zlib-style license that can * be found in the License.txt file in the root of the source tree. */ //--------------------------------------------------------------------------- #ifndef ZenOS_UtilsH #define ZenOS_UtilsH //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "ZenLib/Ztring.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #ifdef WINDOWS_UWP #include #include #include #endif //--------------------------------------------------------------------------- namespace ZenLib { //*************************************************************************** // OS Information //*************************************************************************** //--------------------------------------------------------------------------- bool IsWin9X (); // Execute //*************************************************************************** void Shell_Execute(const Ztring &ToExecute); //*************************************************************************** // Directorues //*************************************************************************** Ztring OpenFolder_Show(void* Handle, const Ztring &Title, const Ztring &Caption); //*************************************************************************** // WinRT Helpers //*************************************************************************** #ifdef WINDOWS_UWP template inline HRESULT Await(const Microsoft::WRL::ComPtr &Operation) { if (!Operation) return E_POINTER; Microsoft::WRL::ComPtr Info; HRESULT Result=Operation.As(&Info); if (FAILED(Result)) return Result; ABI::Windows::Foundation::AsyncStatus Status; while (SUCCEEDED(Result=Info->get_Status(&Status)) && Status==Started) Sleep(0); //Yield if (FAILED(Result) || Status!=Completed) { HRESULT Error_Code; Result=Info->get_ErrorCode(&Error_Code); if (FAILED(Result)) return Result; return Error_Code; } return Result; } HRESULT Add_Item_To_FUA(Microsoft::WRL::Wrappers::HStringReference Path, Microsoft::WRL::ComPtr &Item); HRESULT Get_File(Microsoft::WRL::Wrappers::HStringReference File_Name, Microsoft::WRL::ComPtr &File); HRESULT Get_Folder(Microsoft::WRL::Wrappers::HStringReference Folder_Name, Microsoft::WRL::ComPtr &Folder); #endif } //namespace ZenLib #endif