要求这么多,本来想跟你好好探讨一下的,算了 给你一篇帮助自己翻去吧,我们可以下班了 The 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 ); ParameterslpszDeviceNamePointer to a null-terminated string that specifies the display device whose graphics mode the function will obtain information about. This parameter can be NULL. A NULL value specifies the current display device on the computer that the calling thread is running on. If lpszDeviceName is not NULL, the string must be of the form \\.\DisplayX, where X can have the values 1, 2, or 3. Windows 95: lpszDeviceName must be NULL.iModeNumIndex value that specifies the graphics mode for which information is to be obtained. Graphics mode indexes start at zero. To obtain information for all of a display device's graphics modes, make a series of calls to EnumDisplaySettings, as follows: Set iModeNum to zero for the first call, and increment iModeNum by one for each subsequent call. Continue calling the function until the return value is FALSE. When you call EnumDisplaySettings with iModeNum set to zero, the operating system initializes and caches information about the display device. When you call EnumDisplaySettings with iModeNum set to a non-zero value, the function returns the information that was cached the last time the function was called with iModeNum set to zero.lpDevModePointer to a DEVMODE structure into which the function stores information about the specified graphics mode. The EnumDisplaySettings function sets values for the following five DEVMODE members:dmBitsPerPel dmPelsWidth dmPelsHeight dmDisplayFlags dmDisplayFrequency Return ValuesIf the function succeeds, the return value is nonzero. If the function fails, the return value is zero. The function fails if iModeNum is greater than the index of the display device's last graphics mode. As noted in the description of the iModeNum parameter, you can use this behavior to enumerate all of a display device's graphics modes. See AlsoChangeDisplaySettings, CreateDC, CreateDesktop, DEVMODE
函数EnumDisplaySettings( LPCTSTR lpszDeviceName, // specifies the display device DWORD iModeNum, // specifies the graphics mode LPDEVMODE lpDevMode // points to structure to receive settings ); 参数 iModNum=DWORD(-2);//ENUM_REGISTRY_SETTINGS;
function ChangeDisp(AWidth, AHeight: Integer; Bits: Integer): LongInt; var DevMode: TDevMode; begin Result := -6; if EnumDisplaySettings(nil, 0, DevMode) then begin with DevMode do begin dmBitsPerPel := Bits; dmPelsWidth := AWidth; dmPelsHeight := AHeight; dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL; end; Result := ChangeDisplaySettings(DevMode, CDS_UPDATEREGISTRY); end; end;
给你一篇帮助自己翻去吧,我们可以下班了
The 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
);
ParameterslpszDeviceNamePointer to a null-terminated string that specifies the display device whose graphics mode the function will obtain information about.
This parameter can be NULL. A NULL value specifies the current display device on the computer that the calling thread is running on.
If lpszDeviceName is not NULL, the string must be of the form \\.\DisplayX, where X can have the values 1, 2, or 3.
Windows 95: lpszDeviceName must be NULL.iModeNumIndex value that specifies the graphics mode for which information is to be obtained.
Graphics mode indexes start at zero. To obtain information for all of a display device's graphics modes, make a series of calls to EnumDisplaySettings, as follows: Set iModeNum to zero for the first call, and increment iModeNum by one for each subsequent call. Continue calling the function until the return value is FALSE.
When you call EnumDisplaySettings with iModeNum set to zero, the operating system initializes and caches information about the display device. When you call EnumDisplaySettings with iModeNum set to a non-zero value, the function returns the information that was cached the last time the function was called with iModeNum set to zero.lpDevModePointer to a DEVMODE structure into which the function stores information about the specified graphics mode.
The EnumDisplaySettings function sets values for the following five DEVMODE members:dmBitsPerPel
dmPelsWidth
dmPelsHeight
dmDisplayFlags
dmDisplayFrequency Return ValuesIf the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
The function fails if iModeNum is greater than the index of the display device's last graphics mode. As noted in the description of the iModeNum parameter, you can use this behavior to enumerate all of a display device's graphics modes. See AlsoChangeDisplaySettings, CreateDC, CreateDesktop, DEVMODE
LPCTSTR lpszDeviceName, // specifies the display device
DWORD iModeNum, // specifies the graphics mode
LPDEVMODE lpDevMode // points to structure to receive settings
);
参数 iModNum=DWORD(-2);//ENUM_REGISTRY_SETTINGS;
var
DevMode: TDevMode;
begin
Result := -6;
if EnumDisplaySettings(nil, 0, DevMode) then
begin
with DevMode do
begin
dmBitsPerPel := Bits;
dmPelsWidth := AWidth;
dmPelsHeight := AHeight;
dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL;
end;
Result := ChangeDisplaySettings(DevMode, CDS_UPDATEREGISTRY);
end;
end;