Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: udfEnumDisplayDevices EnumDisplayDevices EnumDisplayDevicesA List Enumerate Display Devices Monitors
#DefineFunction udfEnumDisplayDevices() ;--------------------------------------------------------------------------------; ; udfEnumDisplayDevices : List information about the display devices in ; ; the current session. ; ; ; ;--------------------------------------------------------------------------------; ; parm1 : NA ; ;--------------------------------------------------------------------------------; ; returns : This function creates a tab delimited list of information ; ; about the display devices ; ; DeviceName|DeviceString|StateFlags|DeviceID|DeviceKey ; ; ; ;--------------------------------------------------------------------------------; ; Deana Falk ; ; 2010.04.12 Initial Release ; ;--------------------------------------------------------------------------------; ;BOOL EnumDisplayDevices( ; __in LPCTSTR lpDevice, ; __in DWORD iDevNum, ; __out PDISPLAY_DEVICE lpDisplayDevice, ; __in DWORD dwFlags ;) ;typedef struct _DISPLAY_DEVICE { ; DWORD cb; ; TCHAR DeviceName[32]; ; TCHAR DeviceString[128]; ; DWORD StateFlags; ; TCHAR DeviceID[128]; ; TCHAR DeviceKey[128]; ;} DISPLAY_DEVICE, *PDISPLAY_DEVICE; UserDll = StrCat(DirWindows(1),"USER32.DLL") bufsize = 424 info = '' ;To query all display devices in the current session, call this function in a loop, starting with iDevNum set to 0, and incrementing iDevNum until the function fails. For iDevNum = 0 To 9 PDISPLAY_DEVICE = BinaryAlloc(bufsize) BinaryPoke4(PDISPLAY_DEVICE, 0, bufsize) returnvalue = DllCall(userdll,long:"EnumDisplayDevicesA",lpnull,long:iDevNum,lpbinary:PDISPLAY_DEVICE,long:1) If returnvalue == 0 BinaryFree(PDISPLAY_DEVICE) Break EndIf cb = BinaryPeek4(PDISPLAY_DEVICE, 0 ) BinaryEodSet( PDISPLAY_DEVICE, cb ) devicename = BinaryPeekStr(PDISPLAY_DEVICE, 4, 32) devicestring = BinaryPeekStr(PDISPLAY_DEVICE, 36, 128) state = BinaryPeek4(PDISPLAY_DEVICE, 164 ) deviceid = BinaryPeekStr(PDISPLAY_DEVICE, 168, 128) devicekey = BinaryPeekStr(PDISPLAY_DEVICE, 296, 128) If info == '' Then info = devicename : '|' : devicestring : '|' : state : '|' : deviceid : '|' : devicekey Else info = info : @TAB : devicename : '|' : devicestring : '|' : state : '|' : deviceid : '|' : devicekey BinaryFree(PDISPLAY_DEVICE) Next Return info #EndFunction infolist = udfEnumDisplayDevices() AskItemlist('Display Devices', infolist, @TAB, @UNSORTED, @SINGLE ) Exit
Article ID: W18400
Filename: udfEnumDisplayDevices.txt
File Created: 2010:04:12:15:09:34
Last Updated: 2010:04:12:15:09:34