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 (!initLibraries()) return GL_FALSE; createKeyTables(); if (_glfw_SetProcessDPIAware) _glfw_SetProcessDPIAware(); #ifdef __BORLANDC__ // With the Borland C++ compiler, we want to disable FPU exceptions // (this is recommended for OpenGL applications under Windows) _control87(MCW_EM, MCW_EM); #endif if (!_glfwRegisterWindowClass()) return GL_FALSE; if (!_glfwInitContextAPI()) return GL_FALSE; _glfwInitTimer(); _glfwInitJoysticks(); return GL_TRUE; }
static VOID LoadScreenSaverParameters( OUT LPDWORD Timeout) { BOOL Enabled; if (!SystemParametersInfoW(SPI_GETSCREENSAVETIMEOUT, 0, Timeout, 0)) { WARN("WL: Unable to get screen saver timeout (error %lu). Disabling it\n", GetLastError()); *Timeout = INFINITE; } else if (!SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &Enabled, 0)) { WARN("WL: Unable to check if screen saver is enabled (error %lu). Disabling it\n", GetLastError()); *Timeout = INFINITE; } else if (!Enabled) { TRACE("WL: Screen saver is disabled\n"); *Timeout = INFINITE; } else { TRACE("WL: Screen saver timeout: %lu seconds\n", *Timeout); *Timeout *= 1000; } }
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; }
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 (!initLibraries()) return GL_FALSE; createKeyTables(); if (_glfw_SetProcessDPIAware) _glfw_SetProcessDPIAware(); if (!_glfwRegisterWindowClass()) return GL_FALSE; if (!_glfwInitContextAPI()) return GL_FALSE; _glfwInitTimer(); _glfwInitJoysticks(); return GL_TRUE; }
void System::Internals::disableHotKeyHarassment() { // Don't touch stickykeys/togglekeys/filterkeys if they're being used, // but if they aren't, make sure Windows doesn't harass the user about // maybe enabling them. auto stickyKeys = storedStickyKeys; if ( ( stickyKeys.dwFlags & SKF_STICKYKEYSON ) == 0 ) { stickyKeys.dwFlags &= ~SKF_HOTKEYACTIVE; stickyKeys.dwFlags &= ~SKF_CONFIRMHOTKEY; SystemParametersInfoW( SPI_SETSTICKYKEYS, sizeof( STICKYKEYS ), &stickyKeys, 0 ); } auto toggleKeys = storedToggleKeys; if ( ( toggleKeys.dwFlags & TKF_TOGGLEKEYSON ) == 0 ) { toggleKeys.dwFlags &= ~TKF_HOTKEYACTIVE; toggleKeys.dwFlags &= ~TKF_CONFIRMHOTKEY; SystemParametersInfoW( SPI_SETTOGGLEKEYS, sizeof( TOGGLEKEYS ), &toggleKeys, 0 ); } auto filterKeys = storedFilterKeys; if ( ( filterKeys.dwFlags & FKF_FILTERKEYSON ) == 0 ) { filterKeys.dwFlags &= ~FKF_HOTKEYACTIVE; filterKeys.dwFlags &= ~FKF_CONFIRMHOTKEY; SystemParametersInfoW( SPI_SETFILTERKEYS, sizeof( FILTERKEYS ), &filterKeys, 0 ); } }
int _glfwPlatformInit(void) { if (!_glfwInitThreadLocalStorageWin32()) return GLFW_FALSE; // 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(); if (_glfw_SetProcessDpiAwareness) _glfw_SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); else if (_glfw_SetProcessDPIAware) _glfw_SetProcessDPIAware(); if (!_glfwRegisterWindowClassWin32()) return GLFW_FALSE; _glfw.win32.helperWindowHandle = createHelperWindow(); if (!_glfw.win32.helperWindowHandle) return GLFW_FALSE; _glfwInitTimerWin32(); _glfwInitJoysticksWin32(); return GLFW_TRUE; }
void System::Internals::store() { swapMouseButtons = ( GetSystemMetrics( SM_SWAPBUTTON ) != 0 ); storedStickyKeys.cbSize = sizeof( storedStickyKeys ); SystemParametersInfoW( SPI_GETSTICKYKEYS, sizeof( STICKYKEYS ), &storedStickyKeys, 0 ); storedToggleKeys.cbSize = sizeof( storedToggleKeys ); SystemParametersInfoW( SPI_GETTOGGLEKEYS, sizeof( TOGGLEKEYS ), &storedToggleKeys, 0 ); storedFilterKeys.cbSize = sizeof( storedFilterKeys ); SystemParametersInfoW( SPI_GETFILTERKEYS, sizeof( FILTERKEYS ), &storedFilterKeys, 0 ); }
/*********************************************************************** * GetThemeSysFont (UXTHEME.@) */ HRESULT WINAPI GetThemeSysFont(HTHEME hTheme, int iFontID, LOGFONTW *plf) { HRESULT hr = S_OK; PTHEME_PROPERTY tp; TRACE("(%p, %d)\n", hTheme, iFontID); if(hTheme) { if((tp = MSSTYLES_FindMetric(TMT_FONT, iFontID))) { HDC hdc = GetDC(NULL); hr = MSSTYLES_GetPropertyFont(tp, hdc, plf); ReleaseDC(NULL, hdc); if(SUCCEEDED(hr)) return S_OK; } } if(iFontID == TMT_ICONTITLEFONT) { if(!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), plf, 0)) return HRESULT_FROM_WIN32(GetLastError()); } else { NONCLIENTMETRICSW ncm; LOGFONTW *font = NULL; ncm.cbSize = sizeof(NONCLIENTMETRICSW); if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0)) return HRESULT_FROM_WIN32(GetLastError()); switch(iFontID) { case TMT_CAPTIONFONT: font = &ncm.lfCaptionFont; break; case TMT_SMALLCAPTIONFONT: font = &ncm.lfSmCaptionFont; break; case TMT_MENUFONT: font = &ncm.lfMenuFont; break; case TMT_STATUSFONT: font = &ncm.lfStatusFont; break; case TMT_MSGBOXFONT: font = &ncm.lfMessageFont; break; default: FIXME("Unknown FontID: %d\n", iFontID); break; } if(font) *plf = *font; else hr = STG_E_INVALIDPARAMETER; } return hr; }
void _glfwPlatformTerminate(void) { _glfwUnregisterWindowClassWin32(); // Restore previous foreground lock timeout system setting SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(_glfw.win32.foregroundLockTimeout), SPIF_SENDCHANGE); free(_glfw.win32.clipboardString); #if defined(_GLFW_WGL) _glfwTerminateWGL(); #elif defined(_GLFW_EGL) _glfwTerminateEGL(); #endif _glfwTerminateJoysticksWin32(); _glfwTerminateThreadLocalStorageWin32(); if (_glfw.win32.helperWindow) DestroyWindow(_glfw.win32.helperWindow); freeLibraries(); }
VOID OnCmdRange(ULONG ID) { HWND hWnd; int x, y; RECT rcWindow, rcDesktop; { TEB_ACTIVE_FRAME Frame; Frame.Context = CMD_RANGE_TRAP_CONTEXT; Frame.Data = NULL; Frame.Push(); (this->*StubOnCmdRange)(ID); hWnd = (HWND)Frame.Data; } if (hWnd == NULL) return; if (IsZoomed(hWnd)) return; SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcDesktop, 0); GetWindowRect(hWnd, &rcWindow); x = ((rcDesktop.right - rcDesktop.left) - (rcWindow.right - rcWindow.left)) >> 1; y = ((rcDesktop.bottom - rcDesktop.top) - (rcWindow.bottom - rcWindow.top)) >> 1; SetWindowPos(hWnd, HWND_NOTOPMOST, x, y, 0, 0, SWP_NOSIZE); }
CGSTATUS CCGUICtrl::Create(ULONG X, ULONG Y, ULONG Width, ULONG Height) { BOOL bCenter = (X == -1 && Y == -1); if (Width != 0 && Height != 0) { m_UI.setGeometry(X, Y, Width, Height); } else { RECT rcDesktop; if (SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcDesktop, 0)) { Width = rcDesktop.right - rcDesktop.left; Height = rcDesktop.bottom - rcDesktop.top; Width = Width * 8 / 10; Height = Height * 75 / 100; X = (rcDesktop.right - rcDesktop.left - Width) / 2; Y = (rcDesktop.bottom - rcDesktop.top - Height) / 2; m_UI.setGeometry(X, Y, Width, Height); } } if (bCenter) m_UI.centralWidget(); m_UI.setMinimumSize(m_UI.size()); return STATUS_SUCCESS; }
CCGUI:: CCGUI( QWidget *pParent /* = 0 */, Qt::WFlags Flags /* = 0 */ ) : QMainWindow(pParent, Flags) { LOGFONTW lf; ui.setupUi(this); setWindowTitle(QString::fromUtf16(L"Ðdz½Ö®¼ä")); SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0); QFont font(QApplication::font()); font.setWeight(QFont::Normal); font.setStyleStrategy(QFont::PreferQuality); font.setFamily(QString::fromUtf16(lf.lfFaceName)); QApplication::setFont(font); AllocConsole(); BOOL b; connect(ui.actionFileExit, SIGNAL(triggered()), this, SLOT(close())); b = connect(ui.MenuAbout, SIGNAL(aboutToShow()), this, SLOT(About())); PrintConsoleW(L"%d\n", b); }
static void read_sysparams(HWND hDlg) { WCHAR buffer[256]; HWND list = GetDlgItem(hDlg, IDC_SYSPARAM_COMBO); NONCLIENTMETRICSW nonclient_metrics; int i, idx; for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) { LoadStringW(GetModuleHandleW(NULL), i + IDC_SYSPARAMS_BUTTON, buffer, sizeof(buffer) / sizeof(buffer[0])); idx = SendMessageW(list, CB_ADDSTRING, 0, (LPARAM)buffer); if (idx != CB_ERR) SendMessageW(list, CB_SETITEMDATA, idx, i); if (metrics[i].sm_idx != -1) metrics[i].size = GetSystemMetrics(metrics[i].sm_idx); if (metrics[i].color_idx != -1) metrics[i].color = GetSysColor(metrics[i].color_idx); } nonclient_metrics.cbSize = sizeof(NONCLIENTMETRICSW); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &nonclient_metrics, 0); memcpy(&(metrics[IDC_SYSPARAMS_MENU_TEXT - IDC_SYSPARAMS_BUTTON].lf), &(nonclient_metrics.lfMenuFont), sizeof(LOGFONTW)); memcpy(&(metrics[IDC_SYSPARAMS_ACTIVE_TITLE_TEXT - IDC_SYSPARAMS_BUTTON].lf), &(nonclient_metrics.lfCaptionFont), sizeof(LOGFONTW)); memcpy(&(metrics[IDC_SYSPARAMS_TOOLTIP_TEXT - IDC_SYSPARAMS_BUTTON].lf), &(nonclient_metrics.lfStatusFont), sizeof(LOGFONTW)); memcpy(&(metrics[IDC_SYSPARAMS_MSGBOX_TEXT - IDC_SYSPARAMS_BUTTON].lf), &(nonclient_metrics.lfMessageFont), sizeof(LOGFONTW)); }
void _glfwPlatformTerminate(void) { if (_glfw.win32.deviceNotificationHandle) UnregisterDeviceNotification(_glfw.win32.deviceNotificationHandle); if (_glfw.win32.helperWindowHandle) DestroyWindow(_glfw.win32.helperWindowHandle); _glfwUnregisterWindowClassWin32(); // Restore previous foreground lock timeout system setting SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(_glfw.win32.foregroundLockTimeout), SPIF_SENDCHANGE); free(_glfw.win32.clipboardString); free(_glfw.win32.rawInput); _glfwTerminateWGL(); _glfwTerminateEGL(); _glfwTerminateJoysticksWin32(); freeLibraries(); }
HWND WINAPI CreateWindowExCenterA(ULONG dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, ULONG dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam) { HWND Window; RECT rcWordArea; ULONG Length; PWSTR pszClassName, pszWindowName; Length = StrLengthA(lpClassName) + 1; pszClassName = (PWSTR)AllocStack(Length * sizeof(WCHAR)); AnsiToUnicode(pszClassName, Length, lpClassName, Length); Length = StrLengthA(lpWindowName) + 1; pszWindowName = (PWSTR)AllocStack(Length * sizeof(WCHAR)); AnsiToUnicode(pszWindowName, Length, lpWindowName, Length); if (SystemParametersInfoW(SPI_GETWORKAREA, 0, &rcWordArea, 0)) { X = ((rcWordArea.right - rcWordArea.left) - nWidth) / 2; Y = ((rcWordArea.bottom - rcWordArea.top) - nHeight) / 2; } Window = CreateWindowExW(dwExStyle, pszClassName, pszWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); ChangeMainWindowProc(Window); return Window; }
static void draw_launchers( HDC hdc, RECT update_rect ) { COLORREF color = SetTextColor( hdc, RGB(255,255,255) ); /* FIXME: depends on background color */ int mode = SetBkMode( hdc, TRANSPARENT ); unsigned int i; LOGFONTW lf; HFONT font; SystemParametersInfoW( SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0 ); font = SelectObject( hdc, CreateFontIndirectW( &lf ) ); for (i = 0; i < nb_launchers; i++) { RECT dummy, icon = get_icon_rect( i ), title = get_title_rect( i ); if (IntersectRect( &dummy, &icon, &update_rect )) DrawIconEx( hdc, icon.left, icon.top, launchers[i]->icon, icon_cx, icon_cy, 0, 0, DI_DEFAULTSIZE|DI_NORMAL ); if (IntersectRect( &dummy, &title, &update_rect )) DrawTextW( hdc, launchers[i]->title, -1, &title, DT_CENTER|DT_WORDBREAK|DT_EDITCONTROL|DT_END_ELLIPSIS ); } SelectObject( hdc, font ); SetTextColor( hdc, color ); SetBkMode( hdc, mode ); }
/*********************************************************************** * GetThemeSysBool (UXTHEME.@) */ BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID) { HRESULT hr; PTHEME_PROPERTY tp; BOOL ret; TRACE("(%p, %d)\n", hTheme, iBoolID); SetLastError(0); if(hTheme) { if((tp = MSSTYLES_FindMetric(TMT_BOOL, iBoolID))) { hr = MSSTYLES_GetPropertyBool(tp, &ret); if(SUCCEEDED(hr)) return ret; else SetLastError(hr); } } if(iBoolID == TMT_FLATMENUS) { if(SystemParametersInfoW(SPI_GETFLATMENU, 0, &ret, 0)) return ret; } else { FIXME("Unknown bool id: %d\n", iBoolID); SetLastError(STG_E_INVALIDPARAMETER); } return FALSE; }
static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) { IPADDRESS_INFO *infoPtr; RECT rcClient, edit; int i, fieldsize; HFONT hFont, hSysFont; LOGFONTW logFont, logSysFont; TRACE("\n"); SetWindowLongW (hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER); infoPtr = heap_alloc_zero (sizeof(*infoPtr)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); GetClientRect (hwnd, &rcClient); fieldsize = (rcClient.right - rcClient.left) / 4; edit.top = rcClient.top + 2; edit.bottom = rcClient.bottom - 2; infoPtr->Self = hwnd; infoPtr->Enabled = TRUE; infoPtr->Notify = lpCreate->hwndParent; hSysFont = GetStockObject(ANSI_VAR_FONT); GetObjectW(hSysFont, sizeof(LOGFONTW), &logSysFont); SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); lstrcpyW(logFont.lfFaceName, logSysFont.lfFaceName); hFont = CreateFontIndirectW(&logFont); for (i = 0; i < 4; i++) { IPPART_INFO* part = &infoPtr->Part[i]; part->LowerLimit = 0; part->UpperLimit = 255; edit.left = rcClient.left + i*fieldsize + 6; edit.right = rcClient.left + (i+1)*fieldsize - 2; part->EditHwnd = CreateWindowW (WC_EDITW, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER, edit.left, edit.top, edit.right - edit.left, edit.bottom - edit.top, hwnd, (HMENU) 1, (HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL); SendMessageW(part->EditHwnd, WM_SETFONT, (WPARAM) hFont, FALSE); SetPropW(part->EditHwnd, IP_SUBCLASS_PROP, hwnd); part->OrigProc = (WNDPROC) SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)IPADDRESS_SubclassProc); EnableWindow(part->EditHwnd, infoPtr->Enabled); } IPADDRESS_UpdateText (infoPtr); return 0; }
static VOID HideMinimizedWindows(IN BOOL bHide) { MINIMIZEDMETRICS mm; mm.cbSize = sizeof(mm); if (!SystemParametersInfoW(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0)) { ERR("SystemParametersInfoW failed with %lu\n", GetLastError()); return; } if (bHide) mm.iArrange |= ARW_HIDE; else mm.iArrange &= ~ARW_HIDE; if (!SystemParametersInfoW(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0)) ERR("SystemParametersInfoW failed with %lu\n", GetLastError()); }
HRESULT SkFontMgr_DirectWrite::getDefaultFontFamily(IDWriteFontFamily** fontFamily) const { NONCLIENTMETRICSW metrics; metrics.cbSize = sizeof(metrics); if (0 == SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) { return E_UNEXPECTED; } HRM(this->getByFamilyName(metrics.lfMessageFont.lfFaceName, fontFamily), "Could not create DWrite font family from LOGFONT."); return S_OK; }
static void GetDefaultFontSettingW(LOGFONTW * lf, COLORREF * colour) { SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), lf, FALSE); if(colour) *colour = GetSysColor(COLOR_WINDOWTEXT); lf->lfHeight = 10; HDC hdc = GetDC(0); lf->lfHeight = -MulDiv(lf->lfHeight,GetDeviceCaps(hdc, LOGPIXELSY), 72); ReleaseDC(0, hdc); }
/* Before activating a theme, query current system colors, certain settings * and backup them in the registry, so they can be restored when the theme * is deactivated */ static void UXTHEME_BackupSystemMetrics(void) { HKEY hKey; const struct BackupSysParam* bsp = backupSysParams; if (RegCreateKeyExW( HKEY_CURRENT_USER, szThemeManager, 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0) == ERROR_SUCCESS) { NONCLIENTMETRICSW ncm; LOGFONTW iconTitleFont; /* back up colors */ save_sys_colors (hKey); /* back up "other" settings */ while (bsp->spiGet >= 0) { DWORD value; SystemParametersInfoW (bsp->spiGet, 0, &value, 0); RegSetValueExW (hKey, bsp->keyName, 0, REG_DWORD, (LPBYTE)&value, sizeof (value)); bsp++; } /* back up non-client metrics */ memset (&ncm, 0, sizeof (ncm)); ncm.cbSize = sizeof (ncm); SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (ncm), &ncm, 0); RegSetValueExW (hKey, keyNonClientMetrics, 0, REG_BINARY, (LPBYTE)&ncm, sizeof (ncm)); memset (&iconTitleFont, 0, sizeof (iconTitleFont)); SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (iconTitleFont), &iconTitleFont, 0); RegSetValueExW (hKey, keyIconTitleFont, 0, REG_BINARY, (LPBYTE)&iconTitleFont, sizeof (iconTitleFont)); RegCloseKey (hKey); } }
static VOID SetUserWallpaper(VOID) { HKEY hKey; DWORD Type, Size; WCHAR szWallpaper[MAX_PATH + 1]; LONG rc; TRACE("()\n"); rc = RegOpenKeyExW(HKEY_CURRENT_USER, REGSTR_PATH_DESKTOP, 0, KEY_QUERY_VALUE, &hKey); if (rc != ERROR_SUCCESS) { WARN("RegOpenKeyEx() failed with error %lu\n", rc); return; } Size = sizeof(szWallpaper); rc = RegQueryValueExW(hKey, L"Wallpaper", NULL, &Type, (LPBYTE)szWallpaper, &Size); RegCloseKey(hKey); if (rc == ERROR_SUCCESS && Type == REG_SZ) { ExpandEnvironmentStringsW(szWallpaper, szWallpaper, ARRAYSIZE(szWallpaper)); TRACE("Using wallpaper %s\n", debugstr_w(szWallpaper)); /* Load and change the wallpaper */ SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, szWallpaper, SPIF_SENDCHANGE); } else { /* Remove the wallpaper */ TRACE("No wallpaper set in registry (error %lu)\n", rc); SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, NULL, SPIF_SENDCHANGE); } }
static void apply_sysparams(void) { NONCLIENTMETRICSW nonclient_metrics; int i, cnt = 0; int colors_idx[sizeof(metrics) / sizeof(metrics[0])]; COLORREF colors[sizeof(metrics) / sizeof(metrics[0])]; nonclient_metrics.cbSize = sizeof(nonclient_metrics); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(nonclient_metrics), &nonclient_metrics, 0); nonclient_metrics.iMenuWidth = nonclient_metrics.iMenuHeight = metrics[IDC_SYSPARAMS_MENU - IDC_SYSPARAMS_BUTTON].size; nonclient_metrics.iCaptionWidth = nonclient_metrics.iCaptionHeight = metrics[IDC_SYSPARAMS_ACTIVE_TITLE - IDC_SYSPARAMS_BUTTON].size; nonclient_metrics.iScrollWidth = nonclient_metrics.iScrollHeight = metrics[IDC_SYSPARAMS_SCROLLBAR - IDC_SYSPARAMS_BUTTON].size; memcpy(&(nonclient_metrics.lfMenuFont), &(metrics[IDC_SYSPARAMS_MENU_TEXT - IDC_SYSPARAMS_BUTTON].lf), sizeof(LOGFONTW)); memcpy(&(nonclient_metrics.lfCaptionFont), &(metrics[IDC_SYSPARAMS_ACTIVE_TITLE_TEXT - IDC_SYSPARAMS_BUTTON].lf), sizeof(LOGFONTW)); memcpy(&(nonclient_metrics.lfStatusFont), &(metrics[IDC_SYSPARAMS_TOOLTIP_TEXT - IDC_SYSPARAMS_BUTTON].lf), sizeof(LOGFONTW)); memcpy(&(nonclient_metrics.lfMessageFont), &(metrics[IDC_SYSPARAMS_MSGBOX_TEXT - IDC_SYSPARAMS_BUTTON].lf), sizeof(LOGFONTW)); SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(nonclient_metrics), &nonclient_metrics, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) if (metrics[i].color_idx != -1) { colors_idx[cnt] = metrics[i].color_idx; colors[cnt++] = metrics[i].color; } SetSysColors(cnt, colors_idx, colors); }
/* Make system settings persistent, so they're in effect even w/o uxtheme * loaded. * For efficiency reasons, only the last SystemParametersInfoW sets * SPIF_SENDWININICHANGE */ static void UXTHEME_SaveSystemMetrics(void) { const struct BackupSysParam* bsp = backupSysParams; NONCLIENTMETRICSW ncm; LOGFONTW iconTitleFont; save_sys_colors (HKEY_CURRENT_USER); while (bsp->spiGet >= 0) { DWORD value; SystemParametersInfoW (bsp->spiGet, 0, &value, 0); SystemParametersInfoW (bsp->spiSet, 0, UlongToPtr(value), SPIF_UPDATEINIFILE); bsp++; } memset (&ncm, 0, sizeof (ncm)); ncm.cbSize = sizeof (ncm); SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (ncm), &ncm, 0); SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, sizeof (ncm), &ncm, SPIF_UPDATEINIFILE); memset (&iconTitleFont, 0, sizeof (iconTitleFont)); SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (iconTitleFont), &iconTitleFont, 0); SystemParametersInfoW (SPI_SETICONTITLELOGFONT, sizeof (iconTitleFont), &iconTitleFont, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); }
static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p) { HTMLScreen *This = impl_from_IHTMLScreen(iface); RECT work_area; TRACE("(%p)->(%p)\n", This, p); if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0)) return E_FAIL; *p = work_area.right-work_area.left; return S_OK; }
void RemoteDesktop::DesktopBackground::HideWallpaper(){ //the desktop has to be the default, not screen saver or logon if (!_HidingWallpaper) { if (_SaveWallpaper()){ _SaveWallpaperStyle(); SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, L"", SPIF_SENDCHANGE); _HidingWallpaper = true; } } }
void _glfwPlatformTerminate(void) { _glfwUnregisterWindowClass(); // Restore previous foreground lock timeout system setting SystemParametersInfoW(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(_glfw.win32.foregroundLockTimeout), SPIF_SENDCHANGE); free(_glfw.win32.clipboardString); _glfwTerminateJoysticks(); _glfwTerminateContextAPI(); terminateLibraries(); }
static BOOL get_icon_text_metrics( HWND hwnd, TEXTMETRICW *tm ) { BOOL ret; HDC hdc; LOGFONTW lf; HFONT hfont; hdc = GetDC( hwnd ); SystemParametersInfoW( SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0 ); hfont = SelectObject( hdc, CreateFontIndirectW( &lf ) ); ret = GetTextMetricsW( hdc, tm ); SelectObject( hdc, hfont ); ReleaseDC( hwnd, hdc ); return ret; }
void WindowsPlatformStyle::checkForModernStyle() { if (QSysInfo::windowsVersion() >= QSysInfo::WV_10_0) { HIGHCONTRAST information = {0}; information.cbSize = sizeof(HIGHCONTRAST); BOOL isSuccess(SystemParametersInfoW(SPI_GETHIGHCONTRAST, 0, &information, 0)); m_isModernStyle = !(isSuccess && information.dwFlags & HCF_HIGHCONTRASTON); } else { m_isModernStyle = false; } }