win10設定系統的DPI不用重啟即可生效,請問有相關設定API的資料嗎?
以往我們都是想方設法讀取系統的DPI,現在我想反過來去設定系統的DPI到一個想要的值。
不用改注冊表的方式,謝謝。
uj5u.com熱心網友回復:
試試 EnumDisplaySettings ChangeDisplaySettingsDEVMODE 中 有這樣的描述
dmPrintQuality
Specifies the printer resolution. There are four predefined device-independent values:
DMRES_HIGH
DMRES_MEDIUM
DMRES_LOW
DMRES_DRAFT
If a positive value is given, it specifies the number of dots per inch (DPI) and is therefore device dependent.
實際的我也沒有試過, 你可以測驗下看看
uj5u.com熱心網友回復:
沒有EnumDisplaySettngs,只有EnumDisplaySettingA和EnumDisplaySettingsW兩個函式。uj5u.com熱心網友回復:
搜索Module name: DispRes.cpp
Written by: Jeffrey Richter
Notices: Written 1995 by Jeffrey Richter
uj5u.com熱心網友回復:
// Codes are shown here for reading ! not tested !
void CVcDispResDlg::ChangeResolution()
{
if(!m_bAllowToChange) return;
//
LPCTSTR psz;
UINT nMBBtn;
// Keep the current refresh rate
m_DevSelect.dmDisplayFrequency = GetDeviceCaps((HDC)GetDC(), VREFRESH);
// Attempt to change the display resolution.
switch (ChangeDisplaySettings(&m_DevSelect, CDS_UPDATEREGISTRY))
{
case DISP_CHANGE_SUCCESSFUL:
psz = __TEXT("Display change successful.");
break;
case DISP_CHANGE_RESTART:
psz = __TEXT("You must restart your computer before the ")
__TEXT("new settings will take effect.\n\n")
__TEXT("Do you want to restart your computer now?");
nMBBtn = MB_YESNO;
break;
case DISP_CHANGE_BADFLAGS:
psz = __TEXT("An invalid set of flags was passed in.");
break;
case DISP_CHANGE_FAILED:
psz =__TEXT("The display driver couldn't change the display.");
break;
case DISP_CHANGE_BADMODE:
psz = __TEXT("Invalid settings.");
break;
case DISP_CHANGE_NOTUPDATED:
psz = __TEXT("Unable to write settings to the registry.");
break;
}
// Show the user the results
if (IDYES == AfxMessageBox( psz, nMBBtn | MB_ICONINFORMATION))
{ // If the user wants to reboot the computer, do so.
// Windows NT: We must enable our shutdown privilege,assumming we have it.
// Windows 95: OpenProcessToken, LookupPrivilegeValue, and
// AdjustTokenPrivileges are not implemented and
// are ignored.
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// We want to adjust our process's privileges.
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken);
// Get the LUID for shutdown privilege
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Turn the SE_SHUTDOWN_NAME privilege on for our process
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, 0);
CloseHandle(hToken);
// Shut down and reboot the system.
ExitWindowsEx(EWX_REBOOT, 0);
}
}
uj5u.com熱心網友回復:
EnumDisplaySettingsThe EnumDisplaySettings function obtains information about one of a display device's graphics modes. You can obtain information for all of a display device's graphics modes by making a series of calls to this function.
BOOL EnumDisplaySettings(
LPCTSTR lpszDeviceName, // specifies the display device
DWORD iModeNum, // specifies the graphics mode
LPDEVMODE lpDevMode // points to structure to receive settings
);
uj5u.com熱心網友回復:
SetDisplayConfig轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/25305.html
標籤:界面
上一篇:多行程用redis處理并發的問題
下一篇:來自專科大學IT的迷茫
