本文整理汇总了C++中SystemParametersInfoW函数的典型用法代码示例。如果您正苦于以下问题:C++ SystemParametersInfoW函数的具体用法?C++ SystemParametersInfoW怎么用?C++ SystemParametersInfoW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SystemParametersInfoW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _glfwPlatformInit
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;
}
示例2: LoadScreenSaverParameters
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;
}
}
示例3: _glfwPlatformInit
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;
}
示例4: _glfwPlatformInit
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;
}
示例5: SystemParametersInfoW
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 );
}
}
示例6: GetSystemMetrics
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 );
}
示例7: GetThemeSysFont
/***********************************************************************
* GetThemeSysFont ([email protected])
*/
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;
}
示例8: _glfwPlatformTerminate
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();
}
示例9: OnCmdRange
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);
}
示例10: Create
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;
}
示例11: CCGUI
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);
}
示例12: read_sysparams
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));
}
示例13: _glfwPlatformTerminate
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();
}
示例14: CreateWindowExCenterA
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;
}
示例15: draw_launchers
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 );
}