This should be corrected very shortly...

Sorry folks!
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
' ' SystemParameterInfo These API's were updated slightly to include support ' GetSystemMetrics for multiple monitors. CreateDC was updated to take ' CreateDC a display name in the \\.\DisplayX, where X is a ' number. This can be used in conjunction with ' EnumDisplayDevices to get DC's for specific monitors. '----------------------------------------------------------------------------- ' if we are building on Win95/NT4 headers we need to declare this ourselves ' additional nIndex parameters for GetSystemMetrics(nIndex) Win98/2000 ' %SM_CXSCREEN, %SM_CYSCREEN width/height of the screen of the primary 'display monitor only. #IF NOT %DEF(%SM_CMONITORS) 'these may already be included in Win32API.inc %SM_XVIRTUALSCREEN = 76 'virtual left the virtual screen is the %SM_YVIRTUALSCREEN = 77 'virtual top bounding rectangle of all %SM_CXVIRTUALSCREEN = 78 'virtual width display monitors. %SM_CYVIRTUALSCREEN = 79 'virtual height %SM_CMONITORS = 80 'get number of monitors on the desktop %SM_SAMEDISPLAYFORMAT = 81 'TRUE if all the display monitors have the same 'color format, FALSE otherwise. Note that two 'diplays can have the same bit depth, but different color formats. #ENDIF 'dwFlags for MonitorFromPoint, MonitorFromRect and MonitorFromWindow #IF NOT %DEF(%MONITOR_DEFAULTTONULL) %MONITOR_DEFAULTTONULL = &H0??? 'if monitor is not found, return 0 %MONITOR_DEFAULTTOPRIMARY = &H1??? 'if monitor is not found, return the primary %MONITOR_DEFAULTTONEAREST = &H2??? 'if monitor is not found, return the nearest 'TYPEs and dwFlags for GetMonitorInfo 'set the cbSize member to SIZEOF(MONITORINFO) or SIZEOF(MONITORINFOEX) 'before calling GetMonitorInfo. #IF NOT %DEF(%CCHDEVICENAME) %CCHDEVICENAME = 32 'this may already be included in Win32API.inc #ENDIF TYPE MONITORINFO cbSize AS DWORD 'size of the structure, in bytes rcMonitor AS RECT 'display monitor rectangle, in virtual screen coordinates rcWork AS RECT 'work area rectangle, in virtual screen coordinates dwFlags AS DWORD 'flags that represent attributes of the display monitor END TYPE TYPE MONITORINFOEX cbSize AS DWORD 'size of the structure, in bytes rcMonitor AS RECT 'display monitor rectangle, in virtual screen coordinates rcWork AS RECT 'work area rectangle, in virtual screen units dwFlags AS DWORD 'flags that represent attributes of the display monitor szDevice AS ASCIIZ * %CCHDEVICENAME 'the name of the display monitor END TYPE %MONITORINFOF_PRIMARY = &H1??? 'this is the primary display monitor #ENDIF 'TYPEs and StateFlags for EnumDisplayDivices #IF NOT %DEF (%DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) TYPE DISPLAY_DEVICE cb AS DWORD 'size of the structure, in bytes DeviceName AS ASCIIZ * 32 'device name DeviceString AS ASCIIZ * 128 'device context string StateFlags AS DWORD 'any reasonable combination of DISPLAY_DEVICE_? DeviceId AS ASCIIZ * 128 'Plug and Play identifier DeviceKey AS ASCIIZ * 128 'reserved END TYPE 'DISPLAY_DEVICE state flags %DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = &H1??? 'device is part of desktop %DISPLAY_DEVICE_MULTI_DRIVER = &H2??? ' %DISPLAY_DEVICE_PRIMARY_DEVICE = &H4??? 'the primary desktop is on the 'device. For a system with a ' single display card, this is always set. With multiple display cards, ' only one device can have this set. %DISPLAY_DEVICE_MIRRORING_DRIVER = &H8??? 'device is pseudo-device 'for NetMeeting. %DISPLAY_DEVICE_VGA_COMPATIBLE = &H10??? 'device is VGA compatible %DISPLAY_DEVICE_MODESPRUNED = &H8000000??? 'device has more display modes 'than its output devices support #ENDIF 'options for EnumDisplaySettings #IF NOT %DEF (%ENUM_CURRENT_SETTINGS) %ENUM_CURRENT_SETTINGS = -1& %ENUM_REGISTRY_SETTINGS = -2& #ENDIF
' ' 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 ' Increment iModeNum by one for each subsequent call. ' Continue calling the function until the return value is zero. ' ' When you call EnumDisplaySettings with iModeNum set to zero, the operating ' system initializes and caches the 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 ' fuction was called with iModeNum set to zero.
'----------------------------------------------------------------------------- ' ChangeDisplaySettingsEx ' Same as ChangeDisplaySettings except that it allows the caller to specify ' the device. '----------------------------------------------------------------------------- DECLARE FUNCTION ChangeDisplaySettingsEx LIB "USER32.DLL" _ ALIAS "ChangeDisplaySettingsExA" _ (lpszDeviceName AS ASCIIZ PTR, _ ' [in] name of display device lpDevMode AS DEVMODE, _ ' [in] graphics mode BYVAL hwnd AS LONG, _ ' not used, must be NULL BYVAL dwFlags AS DWORD, _ ' [in] graphics mode options BYVAL lParam AS LONG) _ ' [in] video parameters (or NULL) AS LONG ' varies ' DECLARE FUNCTION ChangeDisplaySettings LIB "USER32.DLL" _ 'in Win32api.inc ' ALIAS "ChangeDisplaySettingsA" _ ' (lpDevMode AS DEVMODE, _ ' [in] graphics mode ' BYVAL dwFlags AS LONG) _ ' [in] graphics mode options ' AS LONG ' varies ' ' lpszDeviceName ' [in] Pointer to a NULL-terminated STRING the specifies the display device ' whose graphics mode the function will obtain information about. Only ' display device names as returned by EnumDisplayDevices are valid. ' ' A NULL value specified the default display device. This default device ' can be determined by calling EnumDisplayDevices and checking the ' DISPLAY_DEVICE_PRIMARY_DEVICE flag. ' ' lpDevMode ' [in] Pointer to a DEVMODE structure that describes the new graphics mode. ' If NULL, all the values currently in the registry will be used for the ' display setting. Passing NULL for lpDevMode and 0 for the dwFlags ' parameter is the easiest way to return to the default mode after a ' dynamic mode change. ' ' The dmSize member must be initialized to the size, in bytes, of the ' DEVMODE structure. The dmDriverExtra member must be initialized to ' indicate the number of bytes of private driver data following the ' DEVMODE structure. In addition, you can use any of the following members ' of the DEVMODE structure: ' ' dmBitsPerPel Bits per pixel ' dmPelsWidth Pixel width ' dmPelsHeight Pixel height ' dmDisplayFlags Mode flags ' dmPisplayFrequency Mode frequency ' dmPosition Win98/2000: Position of the device in a ' multi-monitor configuration ' ' In addition to using one or more of the preceding DEVMODE members, you ' must also set one or more of the following values in the dmFields member ' to change the display settings. ' ' 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_DISPLAYFREQUENCY Use the dmDisplayFrequency value ' DM_POSITION Win98/2000: Use the dmPosition Value ' ' hwnd ' Reserved; must be NULL ' ' dwFlags ' [in] Indicates how the graphics mode should be changed. This parameter ' can be one of the following values. ' ' 0 The graphics mode for the current screen will be ' changed dynamically. ' ' CDS_FULLSCREEN The mode is temporary in nature ' ' CDS_GLOBAL The settings will be saved in the global settings ' area so that they will affect all users on the ' machine. Otherwise, only the settings for the ' user are modified. This flag is only valid when ' specified with the CDS_UPDATEREGISTRY flag. ' ' CDS_NORESET The settings will be saved in the registry, but ' will not take effect. This flag is only vaild ' with the CDS_UPDATEREGISTRY flag. ' ' CDS_RESET The settings should be changed, even if the ' requested settings are the same as the current ' settings. ' ' CDS_SET_PRIMARY This device will become the primary device. ' ' CDS_TEST The system tests if the requested graphics mode ' could be set. ' ' 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_VIDEOPARAMETERS WinNT/2000: When set, the lParam parameter is a ' pointer to a VIDEOPARAMETERS structure. ' Otherwise, lParam must be NULL ' ' Specifying CDS_TEST allows an application to determine which graphics ' modes are actually valid, without causing the system to change to them. ' ' 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. ' ' Return Values ' The ChangeDisplaySettingsEx function returns one of the following values: #IF NOT %DEF (%DISP_CHANGE_SUCCESSFUL) %DISP_CHANGE_SUCCESSFUL = 0& ' The setting change was successful %DISP_CHANGE_FAILED = -1& ' The display driver failed the specified mode %DISP_CHANGE_BADMODE = -2& ' The specified graphics mode not supported %DISP_CHANGE_NOTUPDATED = -3& ' NT/2000 Unable to write settings to Registry %DISP_CHANGE_BADFLAGS = -4& ' An invalid set of flags was passed %DISP_CHANGE_BADPARAM = -5& ' An invaild parameter was passed. This can ' include an invalid flag or combination ' of flags. %DISP_CHANGE_RESTART = 1& 'Computer must be restarted in order for ' specified graphics mode to work. #ENDIF ' Remarks: ' ' To ensure that the DEVMODE structure passed to ChangeDisplaySettingsEx ' is valid and contains only values supported by the display driver, use ' the DEVMODE returned by the EnumDisplaySettings function. ' ' When adding a display monitor in a multiple-monitor system programmatically, ' set DEVMODE.dmFields to DM_POSITION and specify a position ' (in DEVMODE.dmPostion) for the monitor you are adding that is adjacent to ' at least one pixel of the display area of an existing monitor. To detach ' the monitor, set DEVMODE.dmFields to DM_POSITION but set ' DEVMODE.dmPelsWidth and DEVMODE.dmPelsHeight to zero. ' ' When the display mode is changed dynamically, the WM_DISPLAYCHANGE message ' is sent to all running applications with the following parameters: ' ' wParam New bits per pixel ' ' LOWORD(lParam) New pixel width ' ' HIWORD(lParam) New pixel height ' ' Windows95: If the calling thread has any top-level windows, ' ChangeDisplaySettings sends these windows the WM_DISPLAYCHANGE message ' right away (for all other windows the message is posted). This may cause ' the shell to get its message too soon and could squash icons. To avoid ' this problem, have ChangeDisplaySettings do resolution switching by calling ' on a thread with no windows, for example, a new thread. '
DECLARE FUNCTION MonitorFromPoint LIB "USER32.DLL" _ ALIAS "MonitorFromPoint" _ (BYVAL ptx AS LONG, _ '[in] POINTAPI structure by value BYVAL pty AS LONG, _ ' which is point of interest BYVAL dwFlags AS LONG) _ '[in] determine return value AS LONG 'HMONITOR if the point is contained 'within any display monitor, 'otherwise, return value depends on dwFlags: 'MONITOR_DEFAULTTONEAREST returns a handle to the display ' monitor that is nearest to the point 'MONITOR_DEFAULTTONULL returns NULL 'MONITOR_DEFAULTTOPRIMARY returns handle to the primary monitor DECLARE FUNCTION MonitorFromRect LIB "USER32.DLL" _ ALIAS "MonitorFromRect" _ (lprc AS RECT, _ '[in] RECT structure of interest BYVAL dwFlags AS LONG) _ '[in] determine return value AS LONG 'HMONITOR to the monitor that has the 'largest area of intersection with the 'rectangle, if the rectangle intersects 'one or more display monitor rectangles, 'otherwise, return value depends on dwFlags: 'MONITOR_DEFAULTTONEAREST returns a handle to the display ' monitor that is nearest the rectangle 'MONITOR_DEFAULTTONULL returns NULL 'MONITOR_DEFAULTTOPRIMARY returns handle to the primary monitor DECLARE FUNCTION MonitorFromWindow LIB "USER32.DLL" _ ALIAS "MonitorFromWindow" _ (BYVAL hwnd AS LONG, _ '[in] handle to the window of interest BYVAL dwFlags AS LONG) _ '[in] determine return value AS LONG 'HMONITOR to the monitor that has the 'largest area of intersection with the 'window, if the window intersects 'one or more display monitor rectangles, 'otherwise, return value depends on dwFlags: 'MONITOR_DEFAULTTONEAREST returns a handle to the display ' monitor that is nearest the window 'MONITOR_DEFAULTTONULL returns NULL 'MONITOR_DEFAULTTOPRIMARY returns handle to the primary monitor ' 'NOTE: if the window is currently minimized, the rectangle of the ' window before it was minimized is used. DECLARE FUNCTION GetMonitorInfo LIB "USER32.DLL" _ ALIAS "GetMonitorInfoA" _ 'use ANSI version (BYVAL hMonitor AS LONG, _ '[in] handle to display monitor lpmi AS ANY) _ '[out] MONITORINFO or MONITORINFOEX AS LONG _ 'nonzero if function succeeds ' The EnumDisplayMonitors function enumerates the display monitors that ' intersect a region formed by the intersection of a specified clipping ' rectangle and the visible region of a device context. ' ' EnumDisplayMonitors calls an application-specific MonitorEnumProc ' callback function once for each display monitor that intersects ' the region. DECLARE FUNCTION EnumDisplayMonitors LIB "USER32.DLL" _ ALIAS "EnumDisplayMonitors" _ (BYVAL hdc AS LONG, _ '[in] handle to diplay DC lprcClip AS RECT, _ '[in] clipping rectangle BYVAL lpfnEnum AS LONG, _ '[in] callback function pointer BYVAL dwData AS LONG) _ '[in] data for callback function AS LONG 'nonzero if function succeeds 'There are two key reasons to call the EnumDisplayMonitors function: ' ' * You want to draw optimally into a device context that spans several ' display monitors that have different color formats. ' ' * You want to obtain a handle and position rectangle for one or more ' display monitors. ' ' To determine whether all the display monitors in a system share the same ' color format, call GetSystemMetrics(SM_SAMEDISPLAYFORMAT). ' ' You do not need to use the EnumDisplayMonitors function when a window ' spans display monitors that have different color formats. You can ' continue to paint under the assumption that the entire screen has the ' color properties of the primary monitor. Your windows will look fine. ' EnumDisplayMonitors just lets you make them look better. ' ' Setting the hdc parameter to NULL lets you use the EnumDisplayMonitors ' function to obtain a handle and position rectangle for one or more display ' monitors. The following table shows how the four combinations of NULL and ' non-NULL hdc and lprcClip values affect the behavior of the ' EnumDisplayMonitors function. ' ' hdc = NULL, lprcRect = NULL Enumerates all display monitors ' ' hdc = NULL, lprcRect = non-NULL Enumerates all display monitors that ' intersect the clipping rectangle. ' Use virtual screen coordinates for ' the clipping rectangle. ' ' hdc = non-NULL, lprcRect = NULL Enumerates all display monitors that ' intersect the visible region of the ' device context. ' ' The callback function receives a ' handle to a DC for the specific ' display monitor. ' ' hdc = non-NULL, lprcRect = non-NULL Enumerates all display monitors that ' intersect the visible region of the ' device context and the clipping ' rectangle. Use device context ' coordinates for the clipping rectangle ' ' The callback function receives a ' handle to a DC for the specific ' display monitor. ' 'EnumDisplayDevices returns information about the display devices in a system DECLARE FUNCTION EnumDisplayDevices LIB "USER32.DLL" _ ALIAS "EnumDisplayDevicesA" _ 'use ANSI version (pVoid AS ANY, _ 'Unused - should be set to NULL BYVAL iDevNum AS LONG, _ '[in] Index value for device of interest lpDisplayDevice AS DISPLAY_DEVICE, _ '[out] pointer to DISPLAY_DEVICE BYVAL dwFlags AS LONG) _ 'not used - should be set to zero AS LONG 'nonzero if function succeeds ' Before calling EnumDisplayDevices, you must initialize the cb member of ' DISPLAY_DEVICE to the size, in bytes, of DISPLAY_DEVICE. ' ' In order to query all display devices in the system, call this function in ' a loop, starting with iDevNum set to 0, and increment until function fails. ' To query all devices in the desktop, filter out the display devices that ' do no have the DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag in DISPLAY_DEVICE. ' EnumDisplaySettings obtains information about one of the display device's ' graphics modes. You can obtain information for all of the graphics modes ' by making a series of calls to thus function. DECLARE FUNCTION EnumDisplaySettings LIB "USER32.DLL" _ ALIAS "EnumDisplaySettingsA" _ 'use ANSI version (lpszDeviceName AS ASCIIZ, _ '[in] Device Name or NULL BYVAL iModeNum AS LONG, _ '[in] type of information to get lpDevMode AS DEVMODE) _ '[out] pointer to DEVMODE AS LONG 'nonzero if function succeeds ' If lpszDeviceName is NULL, the current display on the conputer on which ' the calling thread is running is specified, otherwise, the string must ' be "\\.\Display1", "\\.\Display2", etc. as returned by EnumDisplayDevices ' in DISPLAY_DEVICE.DeviceName. Documented that lpszDeviceName must be ' NULL with Windows 95/98. ' ' iModeNum specifies the type of information to retrieve. This value can be ' a graphics mode index (starting with zero) or: ' ENUM_CURRENT_SETTINGS (-1) to retrieve the current settings ' ENUM_REGISTRY_SETTINGS (-2) for settings currently stored in the registry ' ' Before calling EnumDisplaySettings, you must initialize the dmSize member ' of DEVMODE to the size, in bytes, of DEVMODE. Set the dmDriverExtra member ' to the size, in bytes, available to receive private driver data. ' ' dmLogPixels specifies the number of pixels per logical inch ' dmBitsPerPel specifies the color resolution (bits per pixel) ' dmPelsWidth specifies the width, in pixels, of the visible devicesurface ' dmPelsHeight specifies the height, in pixels, of the visible device surface ' dmDisplayFlags specify the device's display mode and can be any combination ' of DM_GRAYSCALE for noncolor device (color is assumed) ' DM_INTERLACED for interlaced mode (noninterlaced is assumed) ' dmDisplayFrequency specifies the vertical refresh rate, in hertz. This ' may return as a value of 0 or 1, which specifies the display hardware's ' default refresh rate or a setting made by procedures that do not use ' Win32 functions such as ChangeDisplaySettings. DECLARE FUNCTION ChangeDisplaySettingsEx LIB "USER32.DLL" _ ALIAS "ChangeDisplaySettingsExA" _ (lpszDeviceName AS ASCIIZ PTR, _ lpDevMode AS DEVMODE, _ BYVAL hwnd AS LONG, _ BYVAL dwFlags AS LONG, _ BYVAL lParam AS LONG) _ AS LONG
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: