Using Win32 functions in Visual FoxPro Image Gallery
Device Context
..msdn
ChangeDisplaySettings
CreateCompatibleDC
CreateDC
DeleteDC
DeleteObject
EnumDisplayDevices
EnumDisplaySettings
GetDC
GetDeviceCaps
GetObject
GetObjectType
ReleaseDC
SelectObject
Code examples:
How to change display settings: screen resolution, screen refresh rate
How to detect if additional monitor is connected and active
EnumDisplayDevices
..msdn    Add comment     W32 Constants      Translate this page
The EnumDisplayDevices function lets you obtain information about the display devices in a system.
Code examples:
How to change display settings: screen resolution, screen refresh rate
How to detect if additional monitor is connected and active
Declaration:
BOOL EnumDisplayDevices(
  LPCTSTR lpDevice,                // device name
  DWORD iDevNum,                   // display device
  PDISPLAY_DEVICE lpDisplayDevice, // device information
  DWORD dwFlags                    // reserved
);
FoxPro declaration:
DECLARE INTEGER EnumDisplayDevices IN user32;
    STRING    lpDevice,;
    INTEGER   iDevNum,;
    STRING  @ lpDisplayDevice,;
    INTEGER   dwFlags
Parameters:
lpDevice
[in] Pointer to the device name. If NULL, function returns information for the display adapter(s) on the machine, based on iDevNum.

iDevNum
[in] Index value that specifies the display device of interest.

lpDisplayDevice
[out] Pointer to a DISPLAY_DEVICE structure that receives information about the display device specified by iDevNum.

dwFlags
This parameter is currently not used and should be set to zero.
Return value:
If the function succeeds, the return value is nonzero.
Usage:
nIndex = 0  && start with 0

DO WHILE .T.
    IF EnumDisplayDevices(NULL, nIndex, @cBuffer, 0) = 0
    * the enumeration ended or failed
        RETURN ""
    ENDIF

    nFlags = buf2word(SUBSTR(cBuffer, 165,2))

    IF BitAnd(nFlags, 4) = 4  && primary device
        cResult= SUBSTR(cBuffer, 5,32)
        RETURN SUBSTR(cResult, 1,AT(Chr(0),cResult)-1)
    ENDIF

    nIndex = nIndex + 1
ENDDO

My comment:
To query all display devices in the system, call this function in a loop, starting with iDevNum set to 0, and incrementing iDevNum until the function fails.

To get information on the display adapter, call EnumDisplayDevices with lpDevice set to NULL. Then DISPLAY_DEVICE.DeviceString contains the adapter name.

To obtain information on a display monitor, first call EnumDisplayDevices with lpDevice set to NULL. Then call EnumDisplayDevices with lpDevice set to DISPLAY_DEVICE.DeviceName from the first call to EnumDisplayDevices and with iDevNum set to zero. Then DISPLAY_DEVICE.DeviceString is the monitor name.

See also MonitorFromWindow, GetMonitorInfo, EnumDisplaySettings functions.
Word Index links for the EnumDisplayDevices :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2003-01-21 11:19:27
Modified: 2007-06-11 22:05:55
Visited in last 7 days: 77
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.91.171.137)
13 sec.Function: 'WNetGetUser'
26 sec.Function: 'CeCloseHandle'
40 sec.Function: 'GdipDeleteFontFamily'
53 sec.
Function group: 'Network Management'
1.13 min.Function: 'PlaySound'
1.42 min.Function: 'GetProcAddress'
1.68 min.Function: 'GetVersionEx'
1.92 min.Function: 'DrawDibDraw'
2.17 min.Function: 'GetEnvironmentVariable'
2.38 min.Function: 'CreateFile'
Google
Advertise here!