static XnStatus GetOSName(xnOSInfo* pOSInfo) { if (IsWindows8Point1OrGreater()) sprintf(pOSInfo->csOSName, "%s", "Windows8Point1OrGreater\n"); else if (IsWindows8OrGreater()) sprintf(pOSInfo->csOSName, "%s", "Windows8\n"); else if (IsWindows7SP1OrGreater()) sprintf(pOSInfo->csOSName, "%s", "Windows7SP1\n"); else if (IsWindows7OrGreater()) sprintf(pOSInfo->csOSName, "%s", "Windows7\n"); else if (IsWindowsVistaSP2OrGreater()) sprintf(pOSInfo->csOSName, "%s", "VistaSP2\n"); else if (IsWindowsVistaSP1OrGreater()) sprintf(pOSInfo->csOSName, "%s", "VistaSP1\n"); else if (IsWindowsVistaOrGreater()) sprintf(pOSInfo->csOSName, "%s", "Vista\n"); else if (IsWindowsXPSP3OrGreater()) sprintf(pOSInfo->csOSName, "%s", "XPSP3\n"); else if (IsWindowsXPSP2OrGreater()) sprintf(pOSInfo->csOSName, "%s", "XPSP2\n"); else if (IsWindowsXPSP1OrGreater()) sprintf(pOSInfo->csOSName, "%s", "XPSP1\n"); else if (IsWindowsXPOrGreater()) sprintf(pOSInfo->csOSName, "%s", "XP\n"); else sprintf(pOSInfo->csOSName, "%s", "Unknown win version\n"); return (XN_STATUS_OK); }
void FillCombo(HWND hwnd, int id, int indexSettings) { HKL saved = SettingsGlobal().hkl_lay[indexSettings]; bool found = false; for (int i = 0; i < g_laySize; i++) { HKL cur = g_laylist[i]; WORD langid = LOWORD(cur); TCHAR buf[512]; buf[0] = 0; int flag = IsWindowsVistaOrGreater() ? LOCALE_SNAME : LOCALE_SLANGUAGE; int len = GetLocaleInfo(MAKELCID(langid, SORT_DEFAULT), flag, buf, 512); SW_WINBOOL_LOG(len != 0); SendDlgItemMessage(hwnd, id, CB_ADDSTRING, 0, (LPARAM)buf); if (saved == cur) { found = true; SendDlgItemMessage(hwnd, id, CB_SETCURSEL, (WPARAM)i, (LPARAM)0); } } if(!found) { SendDlgItemMessage(hwnd, id, CB_SETCURSEL, (WPARAM)0, (LPARAM)0); } }
void WeaselService::Start(DWORD dwArgc = 0, PWSTR * pszArgv = NULL) { try { // Tell SCM that the service is starting. SetServiceStatus(SERVICE_START_PENDING); // Perform service-specific initialization. if (IsWindowsVistaOrGreater()) { PRAR RegisterApplicationRestart = (PRAR)::GetProcAddress(::GetModuleHandle(_T("kernel32.dll")), "RegisterApplicationRestart"); RegisterApplicationRestart(NULL, 0); } boost::thread{ [this] { app.Run(); } }; // Tell SCM that the service is started. SetServiceStatus(SERVICE_RUNNING); } catch (DWORD dwError) { // Set the service status to be stopped. SetServiceStatus(SERVICE_STOPPED, dwError); } catch (...) { // Set the service status to be stopped. SetServiceStatus(SERVICE_STOPPED); } }
//Returns true on success (and sets majorVersion and minorVersion). Returns false on failure. bool GetOSVersion(DWORD* majorVersion, DWORD* minorVersion) { bool success = false; if (IsWindowsVistaOrGreater()) { success = true; *majorVersion = 6; *minorVersion = 0; } if (IsWindows7OrGreater()) { *minorVersion = 1; } if (IsWindows8OrGreater()) { *minorVersion = 2; } if (IsWindows8Point1OrGreater()) { *minorVersion = 3; } return success; }
double platform_abstraction::font_default_pt() { #ifdef NANA_WINDOWS //Create default font object. NONCLIENTMETRICS metrics = {}; metrics.cbSize = sizeof metrics; #if(WINVER >= 0x0600) #if defined(NANA_MINGW) OSVERSIONINFO osvi = {}; osvi.dwOSVersionInfoSize = sizeof(osvi); ::GetVersionEx(&osvi); if (osvi.dwMajorVersion < 6) metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth); #else if (!IsWindowsVistaOrGreater()) metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth); #endif #endif ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof metrics, &metrics, 0); auto desktop = ::GetDC(nullptr); auto pt = std::abs(metrics.lfMessageFont.lfHeight) * 72.0 / ::GetDeviceCaps(desktop, LOGPIXELSY); ::ReleaseDC(nullptr, desktop); return pt; #else return 10; #endif }
// Initialize the window to recieve raw-input messages // This needs to be called initially so that Windows will send the messages from the 3D mouse to the window. bool ConnexionClient::InitializeRawInput(HWND hwndTarget) { fWindow = hwndTarget; // Simply fail if there is no window if (!hwndTarget) { return false; } unsigned int numDevices = 0; PRAWINPUTDEVICE devicesToRegister = GetDevicesToRegister(&numDevices); if (numDevices == 0) { return false; } unsigned int cbSize = sizeof(devicesToRegister[0]); for (size_t i = 0; i < numDevices; i++) { // Set the target window to use //devicesToRegister[i].hwndTarget = hwndTarget; // If Vista or newer, enable receiving the WM_INPUT_DEVICE_CHANGE message. if (IsWindowsVistaOrGreater()) { devicesToRegister[i].dwFlags |= RIDEV_DEVNOTIFY; } } return (::RegisterRawInputDevices(devicesToRegister, numDevices, cbSize) != FALSE); }
void VideoBackend::PopulateList() { VideoBackend* backends[4] = { NULL }; // D3D9 > D3D11 > OGL > SW #ifdef _WIN32 g_available_video_backends.push_back(backends[0] = new DX9::VideoBackend); if (IsWindowsVistaOrGreater()) { g_available_video_backends.push_back(backends[1] = new DX11::VideoBackend); //if (IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0)) { g_available_video_backends.push_back(backends[2] = new DX12::VideoBackend); } } #endif // disable OGL video Backend while is merged from master #if !defined(USE_GLES) || USE_GLES3 g_available_video_backends.push_back(backends[2] = new OGL::VideoBackend); #endif g_available_video_backends.push_back(backends[3] = new SW::VideoSoftware); for (int i = 0; i < 4; ++i) { if (backends[i]) { s_default_backend = g_video_backend = backends[i]; break; } } }
STDAPI DllRegisterServer() { if (!IsWindowsVistaOrGreater()) return E_FAIL; return DllRegisterServer(true); }
int _glfwPlatformInit(void) { // To make SetForegroundWindow work as we want, we need to fiddle // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early // as possible in the hope of still being the foreground process) SystemParametersInfoW(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &_glfw.win32.foregroundLockTimeout, 0); SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0), SPIF_SENDCHANGE); if (!loadLibraries()) return GLFW_FALSE; createKeyTables(); _glfwUpdateKeyNamesWin32(); if (_glfwIsWindows10CreatorsUpdateOrGreaterWin32()) SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); else if (IsWindows8Point1OrGreater()) SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); else if (IsWindowsVistaOrGreater()) SetProcessDPIAware(); if (!_glfwRegisterWindowClassWin32()) return GLFW_FALSE; if (!createHelperWindow()) return GLFW_FALSE; _glfwInitTimerWin32(); _glfwInitJoysticksWin32(); _glfwPollMonitorsWin32(); return GLFW_TRUE; }
IWebBrowser2* BrowserFactory::CreateBrowser() { LOG(TRACE) << "Entering BrowserFactory::CreateBrowser"; IWebBrowser2* browser = NULL; DWORD context = CLSCTX_LOCAL_SERVER; if (this->ie_major_version_ == 7 && IsWindowsVistaOrGreater()) { // ONLY for IE 7 on Windows Vista. XP and below do not have Protected Mode; // Windows 7 shipped with IE8. context = context | CLSCTX_ENABLE_CLOAKING; } HRESULT hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, context, IID_IWebBrowser2, reinterpret_cast<void**>(&browser)); // When IWebBrowser2::Quit() is called, the wrapper process doesn't // exit right away. When that happens, CoCreateInstance can fail while // the abandoned iexplore.exe instance is still valid. The "right" way // to do this would be to call ::EnumProcesses before calling // CoCreateInstance, finding all of the iexplore.exe processes, waiting // for one to exit, and then proceed. However, there is no way to tell // if a process ID belongs to an Internet Explorer instance, particularly // when a 32-bit process tries to enumerate 64-bit processes on 64-bit // Windows. So, we'll take the brute force way out, just retrying the call // to CoCreateInstance until it succeeds (the old iexplore.exe process has // exited), or we get a different error code. We'll also set a 45-second // timeout, with 45 seconds being chosen because it's below the default // 60 second HTTP request timeout of most language bindings. if (FAILED(hr) && HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED) { LOG(DEBUG) << "CoCreateInstance for IWebBrowser2 failed due to a " << "browser process that has not yet fully exited. Retrying " << "until the browser process exits and a new instance can " << "be successfully created."; } clock_t timeout = clock() + (45 * CLOCKS_PER_SEC); while (FAILED(hr) && HRESULT_CODE(hr) == ERROR_SHUTDOWN_IS_SCHEDULED && clock() < timeout) { ::Sleep(500); hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, context, IID_IWebBrowser2, reinterpret_cast<void**>(&browser)); } if (FAILED(hr) && HRESULT_CODE(hr) != ERROR_SHUTDOWN_IS_SCHEDULED) { // If we hit this branch, the CoCreateInstance failed due to an unexpected // error, either before we looped, or at some point during the loop. In // in either case, there's not much else we can do except log the failure. LOGHR(WARN, hr) << "CoCreateInstance for IWebBrowser2 failed."; } if (browser != NULL) { browser->put_Visible(VARIANT_TRUE); } return browser; }
// Scope-based to indicate to NV driver that CPU PhysX is happening physx::PhysXIndicator::PhysXIndicator(bool isGpu) : mPhysXDataPtr(0), mFileHandle(0), mIsGpu(isGpu) { // Get the windows version (we can only create Global\\ namespace objects in XP) /** Operating system Version number ---------------- -------------- Windows 7 6.1 Windows Server 2008 R2 6.1 Windows Server 2008 6.0 Windows Vista 6.0 Windows Server 2003 R2 5.2 Windows Server 2003 5.2 Windows XP 5.1 Windows 2000 5.0 **/ char configName[128]; #if _MSC_VER >= 1800 if (!IsWindowsVistaOrGreater()) #else OSVERSIONINFOEX windowsVersionInfo; windowsVersionInfo.dwOSVersionInfoSize = sizeof (windowsVersionInfo); GetVersionEx((LPOSVERSIONINFO)&windowsVersionInfo); if (windowsVersionInfo.dwMajorVersion < 6) #endif NvPhysXToDrv_Build_SectionNameXP(GetCurrentProcessId(), configName); else NvPhysXToDrv_Build_SectionName(GetCurrentProcessId(), configName); mFileHandle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(NvPhysXToDrv_Data_V1), configName); if (!mFileHandle || mFileHandle == INVALID_HANDLE_VALUE) return; bool alreadyExists = ERROR_ALREADY_EXISTS == GetLastError(); mPhysXDataPtr = (physx::NvPhysXToDrv_Data_V1*)MapViewOfFile(mFileHandle, FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(NvPhysXToDrv_Data_V1)); if(!mPhysXDataPtr) return; if (!alreadyExists) { mPhysXDataPtr->bCpuPhysicsPresent = 0; mPhysXDataPtr->bGpuPhysicsPresent = 0; } updateCounter(1); // init header last to prevent race conditions // this must be done because the driver may have already created the shared memory block, // thus alreadyExists may be true, even if PhysX hasn't been initialized NvPhysXToDrv_Header_Init(mPhysXDataPtr->header); }
void n2e_ScintillaDPIUpdate(const HWND hwnd, const WPARAM dpi) { if (!IsWindowsVistaOrGreater()) { return; } SciCall_SetDPI(dpi); }
RimeWithWeaselHandler::RimeWithWeaselHandler(weasel::UI *ui) : m_ui(ui) , m_active_session(0) , m_disabled(true) , _UpdateUICallback(NULL) , m_vista_greater(IsWindowsVistaOrGreater()) { _Setup(); }
int w__openConsole(lua_State *L) { static bool is_open = false; if (is_open) { love::luax_pushboolean(L, is_open); return 1; } is_open = true; // FIXME: we don't call AttachConsole in Windows XP because it seems to // break later AllocConsole calls if it fails. A better workaround might be // possible, but it's hard to find a WinXP system to test on these days... if (!IsWindowsVistaOrGreater() || !AttachConsole(ATTACH_PARENT_PROCESS)) { // Create our own console if we can't attach to an existing one. if (!AllocConsole()) { is_open = false; love::luax_pushboolean(L, is_open); return 1; } SetConsoleTitle(TEXT("LOVE Console")); const int MAX_CONSOLE_LINES = 5000; CONSOLE_SCREEN_BUFFER_INFO console_info; // Set size. GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &console_info); console_info.dwSize.Y = MAX_CONSOLE_LINES; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), console_info.dwSize); } FILE *fp; // Redirect stdout. fp = freopen("CONOUT$", "w", stdout); if (L && fp == NULL) return luaL_error(L, "Console redirection of stdout failed."); // Redirect stdin. fp = freopen("CONIN$", "r", stdin); if (L && fp == NULL) return luaL_error(L, "Console redirection of stdin failed."); // Redirect stderr. fp = freopen("CONOUT$", "w", stderr); if (L && fp == NULL) return luaL_error(L, "Console redirection of stderr failed."); love::luax_pushboolean(L, is_open); return 1; }
void n2e_ScintillaDPIInit(const HWND hwnd) { if (!IsWindowsVistaOrGreater()) { return; } RECT rc = { 0 }; GetWindowRect(hwnd, &rc); const POINT pt = { rc.left, rc.top }; SciCall_SetDPI(GetDPIFromMonitor(MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY), hwnd)); }
INT_PTR DialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam) { static const ControlTemplate::Control s_Controls[] = { CT_BUTTON(Id_CloseButton, ID_STR_CLOSE, 344, 191, 50, 14, WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 0), CT_TAB(Id_Tab, 0, 6, 6, 388, 181, WS_VISIBLE | WS_TABSTOP | TCS_FIXEDWIDTH, 0) // Last for correct tab order. }; CreateControls(s_Controls, _countof(s_Controls), m_Font, GetString); HWND item = GetControl(Id_Tab); m_TabLog.Create(m_Window); m_TabSkins.Create(m_Window); m_TabPlugins.Create(m_Window); m_TabVersion.Create(m_Window); TCITEM tci = {0}; tci.mask = TCIF_TEXT; tci.pszText = GetString(ID_STR_LOG); TabCtrl_InsertItem(item, 0, &tci); tci.pszText = GetString(ID_STR_SKINS); TabCtrl_InsertItem(item, 1, &tci); tci.pszText = GetString(ID_STR_PLUGINS); TabCtrl_InsertItem(item, 2, &tci); tci.pszText = GetString(ID_STR_VERSION); TabCtrl_InsertItem(item, 3, &tci); HICON hIcon = GetIcon(IDI_RAINMETER); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); item = GetControl(Id_CloseButton); SendMessage(m_Window, WM_NEXTDLGCTL, (WPARAM)item, TRUE); if (IsWindowsVistaOrGreater()) { item = m_TabLog.GetControl(TabLog::Id_ItemsListView); SetWindowTheme(item, L"explorer", nullptr); item = m_TabSkins.GetControl(TabSkins::Id_ItemsListView); SetWindowTheme(item, L"explorer", nullptr); } if (c_WindowPlacement.length == 0) { c_WindowPlacement.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(m_Window, &c_WindowPlacement); } SetWindowPlacement(m_Window, &c_WindowPlacement); return TRUE; }
void BrowserFactory::ClearCache() { LOG(TRACE) << "Entering BrowserFactory::ClearCache"; if (this->clear_cache_) { if (IsWindowsVistaOrGreater()) { LOG(DEBUG) << "Clearing cache with low mandatory integrity level as required on Windows Vista or later."; this->InvokeClearCacheUtility(true); } LOG(DEBUG) << "Clearing cache with normal process execution."; this->InvokeClearCacheUtility(false); } }
void InitDialogHotKey(HWND hwnd, LPARAM lparam) { SW_TSTATUS_LOG(CenterWindow(g_dlgData.hwndMainMenu, hwnd)); g_hkdata = (DlgHotKeyData*)lparam; g_hkdata->hwnd = hwnd; std::wstring sKeyRevert; g_hkdata->keyDefault.ToString(sKeyRevert); SetDlgItemText(hwnd, IDC_RADIO_DEFAULT, sKeyRevert.c_str()); KeyToDlg(g_hkdata->keyRevert, IDC_EDIT_BREAK, hwnd); g_hkdata->oldEditBreakProc = (WNDPROC)SetWindowLongPtr( GetDlgItem(hwnd, IDC_EDIT_BREAK), GWLP_WNDPROC, (LONG_PTR)EditBreakProc); SW_WINBOOL_LOG(g_hkdata->oldEditBreakProc != NULL); g_hkdata->hwndEditRevert = GetDlgItem(hwnd, IDC_EDIT_BREAK); if(g_hkdata->keyRevert == g_hkdata->keyDefault) { SetRadio(IDC_RADIO_DEFAULT, hwnd); } else if (g_hkdata->keyRevert.IsEmpty()) { SetRadio(IDC_RADIO_CLEAR, hwnd); } else { SetRadio(IDC_RADIO_TYPE, hwnd); } CheckDlgButton(hwnd, IDC_CHECK_LEFTRIGHT, g_hkdata->keyRevert.GetLeftRightMode() ? BST_CHECKED : BST_UNCHECKED); SetFocus(GetDlgItem(hwnd, IDC_EDIT_BREAK)); CAutoHMODULE hModUser; if (!IsWindowsVistaOrGreater()) { hModUser = LoadLibrary(L"user32.dll"); } g_hkdata->hHookKeyGlobal = ntapi::SetWindowsHookEx(WH_KEYBOARD_LL, &LowLevelKeyboardProc, hModUser, 0); SW_WINBOOL_LOG(g_hkdata->hHookKeyGlobal.IsValid()); }
PUINT32 GetHeapFlags_x86() { PUINT32 pProcessHeap, pHeapFlags = NULL; if (IsWindowsVistaOrGreater()){ pProcessHeap = (PUINT32)(__readfsdword(0x30) + 0x18); pHeapFlags = (PUINT32)(*pProcessHeap + 0x40); } else { pProcessHeap = (PUINT32)(__readfsdword(0x30) + 0x18); pHeapFlags = (PUINT32)(*pProcessHeap + 0x0C); } return pHeapFlags; }
PUINT32 GetForceFlags_x64() { PINT64 pProcessHeap = NULL; PUINT32 pHeapForceFlags = NULL; if (IsWindowsVistaOrGreater()){ pProcessHeap = (PINT64)(__readgsqword(0x60) + 0x30); pHeapForceFlags = (PUINT32)(*pProcessHeap + 0x74); } else { pProcessHeap = (PINT64)(__readgsqword(0x60) + 0x30); pHeapForceFlags = (PUINT32)(*pProcessHeap + 0x18); } return pHeapForceFlags; }
void dectectOS() //TODO:Fix this as it doesn't know how to check version { char *osVersion; //if(IsWindows10OrGreater()) osVersion = "Windows 10"; if(IsWindows8Point1OrGreater()) osVersion = "Windows 8.1"; else if(IsWindows8OrGreater()) osVersion = "Windows 8"; else if(IsWindows7SP1OrGreater()) osVersion = "Windows 7 Service Pack 1"; else if(IsWindowsVistaSP2OrGreater()) osVersion = "Windows Vista Service Pack 2"; else if(IsWindowsVistaSP1OrGreater()) osVersion = "Windows Vista Service Pack 1"; else if(IsWindowsVistaOrGreater()) osVersion = "Windows Vista"; else if(IsWindowsXPSP3OrGreater()) osVersion = "Windows XP Service Pack 3"; else if(IsWindowsXPSP2OrGreater()) osVersion = "Windows XP Service Pack 2"; else if(IsWindowsXPSP1OrGreater()) osVersion = "Windows XP Service Pack 1"; else if(IsWindowsXPOrGreater()) osVersion = "Windows XP"; else if(IsWindowsServer()) osVersion = "Windows Server"; printf("\nOS Version : %s", osVersion); }
bool InstallMssFix(void) { char FixMss[256]; if(!GothicReadIniString("DEBUG", "FixMss", "1", FixMss, 256, "SystemPack.ini")) GothicWriteIniString("DEBUG", "FixMss", "1", "SystemPack.ini"); if(IsWindowsVistaOrGreater() && (atoi(FixMss) == 1)) { uChar* codeBase = (uChar*)GetModuleHandle(_T("Mss32.dll")); if(codeBase) { PIMAGE_IMPORT_DESCRIPTOR importDesc = GetImportDescriptor(codeBase, "KERNEL32.dll"); if(!importDesc) return false; return PatchImportFunctionAddress<FARPROC>(codeBase, importDesc, false, "LoadLibraryA", (FARPROC)MyLoadLibraryA); } } return true; }
void Host::initOS() { #ifdef NUCLEUS_TARGET_ANDROID os.name = "Android"; #endif #ifdef NUCLEUS_TARGET_IOS os.name = "iOS"; #endif #ifdef NUCLEUS_TARGET_LINUX os.name = "Linux"; #endif #ifdef NUCLEUS_TARGET_OSX os.name = "OSX"; #endif #ifdef NUCLEUS_TARGET_UWP os.name = "Windows"; #endif #ifdef NUCLEUS_TARGET_WINDOWS if (IsWindows10OrGreater()) { os.name = "Windows 10"; } else if (IsWindows8Point1OrGreater()) { os.name = "Windows 8.1"; } else if (IsWindows8OrGreater()) { os.name = "Windows 8"; } else if (IsWindows7OrGreater()) { os.name = "Windows 7"; } else if (IsWindowsVistaSP2OrGreater()) { os.name = "Windows Vista SP2"; } else if (IsWindowsVistaSP1OrGreater()) { os.name = "Windows Vista SP1"; } else if (IsWindowsVistaOrGreater()) { os.name = "Windows Vista"; } else if (IsWindowsXPSP3OrGreater()) { os.name = "Windows XP SP3"; } else if (IsWindowsXPSP2OrGreater()) { os.name = "Windows XP SP2"; } else if (IsWindowsXPSP1OrGreater()) { os.name = "Windows XP SP1"; } else if (IsWindowsXPOrGreater()) { os.name = "Windows XP"; } #endif }
void DialogAbout::TabSkins::Initialize() { // Add columns to the list view HWND item = GetControl(Id_ItemsListView); ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER); LVGROUP lvg; lvg.cbSize = sizeof(LVGROUP); lvg.mask = LVGF_HEADER | LVGF_GROUPID | LVGF_STATE; lvg.state = (IsWindowsVistaOrGreater()) ? LVGS_COLLAPSIBLE : LVGS_NORMAL; lvg.iGroupId = 0; lvg.pszHeader = GetString(ID_STR_MEASURES); ListView_InsertGroup(item, 0, &lvg); lvg.iGroupId = 1; lvg.pszHeader = GetString(ID_STR_VARIABLES); ListView_InsertGroup(item, 1, &lvg); ListView_EnableGroupView(item, TRUE); LVCOLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; lvc.iSubItem = 0; lvc.cx = 120; lvc.pszText = GetString(ID_STR_NAME); ListView_InsertColumn(item, 0, &lvc); lvc.iSubItem = 1; lvc.cx = 90; lvc.pszText = GetString(ID_STR_RANGE); ListView_InsertColumn(item, 1, &lvc); lvc.iSubItem = 2; // Start 3rd column at max width RECT rect; lvc.cx = GetWindowRect(item, &rect) ? (rect.right - rect.left - 230) : 130; lvc.pszText = GetString(ID_STR_VALUE); ListView_InsertColumn(item, 2, &lvc); UpdateSkinList(); m_Initialized = true; }
static void swapBuffersWGL(_GLFWwindow* window) { if (!window->monitor) { if (IsWindowsVistaOrGreater()) { BOOL enabled; // HACK: Use DwmFlush when desktop composition is enabled if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) { int count = abs(window->context.wgl.interval); while (count--) DwmFlush(); } } } SwapBuffers(window->context.wgl.dc); }
int wmain(void) { //if (IsWindows10OrGreater()) { // wprintf(L"This is Windows 10+"); // } if (IsWindows8Point1OrGreater()) { wprintf(L"This is Windows 8.1+\n"); } else if (IsWindows8OrGreater()) { wprintf(L"This is Windows 8\n"); } else if (IsWindows7OrGreater ()) { wprintf(L"This is Windows 7\n"); } else if (IsWindowsVistaOrGreater ()) { wprintf(L"This is Windows Vista\n"); } else if (IsWindowsXPOrGreater()) { wprintf(L"This is Windows XP\n"); } return 0; }
platform_spec::platform_spec() { //Create default font object. NONCLIENTMETRICS metrics = {}; metrics.cbSize = sizeof metrics; #if(WINVER >= 0x0600) #if defined(NANA_MINGW) OSVERSIONINFO osvi = {}; osvi.dwOSVersionInfoSize = sizeof(osvi); ::GetVersionEx(&osvi); if (osvi.dwMajorVersion < 6) metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth); #else if(!IsWindowsVistaOrGreater()) metrics.cbSize -= sizeof(metrics.iPaddedBorderWidth); #endif #endif ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof metrics, &metrics, 0); def_font_ptr_ = make_native_font(to_utf8(metrics.lfMessageFont.lfFaceName).c_str(), font_size_to_height(9), 400, false, false, false); }
bool initAudio(){ if (!IsWindowsVistaOrGreater()) return false; CComPtr<IMMDevice> pDevice; // get Mgr & EndpointVolume CComPtr<IMMDeviceEnumerator> pDeviceEnumerator; // select output device CComPtr<IAudioSessionManager2> pAudioSessionManager2; // get enumerator // Init CoInitializeEx(NULL, COINIT_MULTITHREADED); // Device Enumerator pDeviceEnumerator.CoCreateInstance(__uuidof(MMDeviceEnumerator)); // get Default Audio Endpoint Device pDeviceEnumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &pDevice); // get AudioSessionMgr2 and AudioEndpointVolume pDevice->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, NULL, (VOID**)&pAudioSessionManager2); pDevice->Activate(__uuidof(IAudioEndpointVolume), CLSCTX_ALL, NULL, (VOID**)&pEpVol); // get Audio Session Enumerator pAudioSessionManager2->GetSessionEnumerator(&pAudioSessionEnumerator); return true; }
void MachineInfo::make_info() { //FunctionHooks* FH = new FunctionHooks; DWORD size; size = MAX_COMPUTERNAME_LENGTH + 1; GetComputerNameA(this->PC_Name, &size); // Wpisanie nazwy komputera size = UNLEN + 1; GetUserNameA(this->Username, &size); // Wpisanie nazwy u¿ytkownika /*----------------Wpisanie informacji o maksymalnym taktowaniu CPU--------------------*/ SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); size = sysInfo.dwNumberOfProcessors * sizeof(PROCESSOR_POWER_INFORMATION); LPBYTE buf = new BYTE[size]; CallNtPowerInformation(ProcessorInformation, NULL, 0, buf, size); PPROCESSOR_POWER_INFORMATION cpuinfo = (PPROCESSOR_POWER_INFORMATION)buf; std::string full_cpu_ratio = intToStr(cpuinfo->MaxMhz) + "GHz"; full_cpu_ratio.erase(3, 1); full_cpu_ratio.insert(1, "."); memcpy(this->CPU_clock, full_cpu_ratio.c_str(), sizeof(full_cpu_ratio)); /*------------------------------------------------------------------------------------*/ /*-----------------------Sprawdzenie wersji systemu Windows---------------------------*/ if (IsWindows8Point1OrGreater())memcpy(this->OS, "Windows 8.1", sizeof("Windows 8.1")); else if (IsWindows7OrGreater())memcpy(this->OS, "Windows 7", sizeof("Windows 7")); else if (IsWindowsVistaOrGreater())memcpy(this->OS, "Windows Vista", sizeof("Windows Vista")); else if (IsWindowsXPOrGreater())memcpy(this->OS, "Windows XP", sizeof("Windows XP")); /*------------------------------------------------------------------------------------*/ }
static void swapIntervalWGL(int interval) { _GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot); window->context.wgl.interval = interval; if (!window->monitor) { if (IsWindowsVistaOrGreater()) { BOOL enabled; // HACK: Disable WGL swap interval when desktop composition is enabled to // avoid interfering with DWM vsync if (SUCCEEDED(DwmIsCompositionEnabled(&enabled)) && enabled) interval = 0; } } if (_glfw.wgl.EXT_swap_control) _glfw.wgl.SwapIntervalEXT(interval); }