本文整理汇总了C++中mozilla::IsWin8OrLater方法的典型用法代码示例。如果您正苦于以下问题:C++ mozilla::IsWin8OrLater方法的具体用法?C++ mozilla::IsWin8OrLater怎么用?C++ mozilla::IsWin8OrLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozilla
的用法示例。
在下文中一共展示了mozilla::IsWin8OrLater方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adtw
/*
* Show a folder picker.
*
* @param aInitialDir The initial directory, the last used directory will be
* used if left blank.
* @return true if a file was selected successfully.
*/
bool
nsFilePicker::ShowFolderPicker(const nsString& aInitialDir)
{
if (!IsWin8OrLater()) {
// Some Windows 7 users are experiencing a race condition when some dlls
// that are loaded by the file picker cause a crash while attempting to shut
// down the COM multithreaded apartment. By instantiating EnsureMTA, we hold
// an additional reference to the MTA that should prevent this race, since
// the MTA will remain alive until shutdown.
EnsureMTA ensureMTA;
}
RefPtr<IFileOpenDialog> dialog;
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC,
IID_IFileOpenDialog,
getter_AddRefs(dialog)))) {
return false;
}
// hook up event callbacks
dialog->Advise(this, &mFDECookie);
// options
FILEOPENDIALOGOPTIONS fos = FOS_PICKFOLDERS;
dialog->SetOptions(fos);
// initial strings
dialog->SetTitle(mTitle.get());
if (!mOkButtonLabel.IsEmpty()) {
dialog->SetOkButtonLabel(mOkButtonLabel.get());
}
if (!aInitialDir.IsEmpty()) {
RefPtr<IShellItem> folder;
if (SUCCEEDED(
WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), nullptr,
IID_IShellItem,
getter_AddRefs(folder)))) {
dialog->SetFolder(folder);
}
}
AutoDestroyTmpWindow adtw((HWND)(mParentWidget.get() ?
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
// display
RefPtr<IShellItem> item;
if (FAILED(dialog->Show(adtw.get())) ||
FAILED(dialog->GetResult(getter_AddRefs(item))) ||
!item) {
dialog->Unadvise(mFDECookie);
return false;
}
dialog->Unadvise(mFDECookie);
// results
// If the user chose a Win7 Library, resolve to the library's
// default save folder.
RefPtr<IShellItem> folderPath;
RefPtr<IShellLibrary> shellLib;
CoCreateInstance(CLSID_ShellLibrary, nullptr, CLSCTX_INPROC,
IID_IShellLibrary, getter_AddRefs(shellLib));
if (shellLib &&
SUCCEEDED(shellLib->LoadLibraryFromItem(item, STGM_READ)) &&
SUCCEEDED(shellLib->GetDefaultSaveFolder(DSFT_DETECT, IID_IShellItem,
getter_AddRefs(folderPath)))) {
item.swap(folderPath);
}
// get the folder's file system path
return WinUtils::GetShellItemPath(item, mUnicodeFile);
}
示例2: IsWinRTDLLPresent
static bool IsWinRTDLLPresent(PDelayLoadInfo pdli, const char* aLibToken)
{
return (IsWin8OrLater() && pdli->szDll &&
!strnicmp(pdli->szDll, aLibToken, strlen(aLibToken)));
}