Can this help any one?
It just confuses me further!
Information is taken from Win32 API.
--------------------------------------------------------------------------
EnumDisplaySettingsA
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.
Declare Function EnumDisplaySettingsA Lib "user32.dll" _
( _
ByVal lpszDeviceName As Long, _
ByVal iModeNum As Long, _
lpDevMode As DEVMODE) As Boolean
Parameters
lpszDeviceName
Pointer 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.
iModeNum
Index 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 and when iModeNum is -1
the return value is current setting.
lpDevMode
Pointer 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 Values
If 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.
--------------------------------------------------------------------------
ChangeDisplaySettingsA
The ChangeDisplaySettings function changes the display settings to the
specified graphics mode.
Declare Function ChangeDisplaySettingsA Lib "user32.dll" _
( _
lpDevMode As DEVMODE, _
ByVal dvFlags As Long _
) As Long
Parameters
lpDevMode
Pointer to a DEVMODE structure that describes the graphics mode to
switch to. The dmSize member must be initialized to the size, in bytes, of
the DEVMODE structure. The following fields in the DEVMODE structure are
used:
Member Meaning
dmBitsPerPel Bits per pixel
dmPelsWidth Pixel width
dmPelsHeight Pixel height
dmDisplayFlags Mode flags
dmDisplayFrequency Mode frequency
In addition to setting a value in one or more of the preceding DEVMODE
members, you must also set the appropriate flags in the dmFields member. The
flags indicate which members of the DEVMODE structure are used for the
display settings change. If the appropriate bit is not set in dmFields, the
display setting will not be changed. Set one or more of the following flags:
Flag Meaning
DM_BITSPERPEL Use the dmBitsPerPel value.
DM_PELSWIDTH Use the dmPelsWidth value.
DM_PELSHEIGHT Use the dmPelsHeight value.
DM_DISPLAYFLAGS Use the dmDisplayFlags value.
DM_DISPLAYFREQENCY Use the dmDisplayFrequency value.
If lpDevMode is NULL, all the values currently in the registry will be
used for the display setting. Passing NULL for the lpDevMode parameter is
the easiest way to return to the default mode after a dynamic mode change.
dwflags
Indicates how the graphics mode should be changed. May be one of the
following:
Flag Meaning
0 The graphics mode for the current screen will be changed
dynamically.
CDS_UPDATEREGISTRY The graphics mode for the current screen
will be changed dynamically and the graphics mode will be updated in the
registry. The mode information is stored in the USER profile.
CDS_TEST The system tests if the requested graphics mode could
be set.
If CDS_UPDATEREGISTRY is specified and it is possible to change the
graphics mode dynamically, the information is stored in the registry and
DISP_CHANGE_SUCCESSFUL is returned. If it is not possible to change the
graphics mode dynamically, the information is stored in the registry and
DISP_CHANGE_RESTART is returned.
Windows NT: If the information could not be stored in the registry,
the graphics mode is not changed and DISP_CHANGE_NOTUPDATED is returned.
Specifying CDS_TEST allows an application to determine which graphics
modes are actually valid, without causing the system to change to that
graphics mode.
Return Values
Returns one of the following values:
Value Meaning
DISP_CHANGE_SUCCESSFUL The settings change was successful.
DISP_CHANGE_RESTART The computer must be restarted in order for
the graphics mode to work.
DISP_CHANGE_BADFLAGS An invalid set of flags was passed in.
DISP_CHANGE_FAILED The display driver failed the specified
graphics mode.
DISP_CHANGE_BADMODE The graphics mode is not supported.
DISP_CHANGE_NOTUPDATED Windows NT only: Unable to write
settings to the registry.
Remarks
Using the DEVMODE returned by the EnumDisplaySettings function ensures
that the DEVMODE passed to ChangeDisplaySettings is valid and contains only
values supported by the display driver.
When the display mode is changed dynamically, the WM_DISPLAYCHANGE
message is sent to all running applications with the following message
parameters:
Parameters Meaning
wParam New bits per pixel
LOWORD(lParam) New pixel width
HIWORD(lParam) New pixel height
"Jesper Lundorf Thusgaard" skrev i en
meddelelse news:3ed38c17$0$83060$edfadb0f@dtext01.news.tele.dk...
> Hi
>
> I'm in desperat need of some help.
> Due to a faulty driver to a graphics card I need to change either the
> resoultion or the colour debt in windows from time to time. As I know
> exactly when this occurs and the PC is running LV I want a LV solution.
>
> I know it's something to do with the windows API. I'm not allowed to buy
any
> solution (I know of G-tool) so I have to find free code or find it out my
> self.
> Finding out my self is not realy an option as I have 3 other projects
> reaching their deadline in the next 2 weeks.
>
> Did any one do a VI to change either colur or resolution on the fly in
> windows it would be very helpful.
>
> I'm running W2K!
>
> J;-)
>
>
>