﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1048	_WinAPI_EnumDisplayDevices() Example in Help-File wrong	KaFu	Jpm	"; HiHo Devs,
; the example for _WinAPI_EnumDisplayDevices() in the help-file
; seems to be wrong. See attached function _Main_OLD() for the
; org example and _Main_NEW() for my proposed new example
; Best Regards

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main_OLD()

Func _Main_OLD()
    Local $aDevice, $i = 0, $text
    While 1
        $aDevice = _WinAPI_EnumDisplayDevices("""", $i)
        If Not $aDevice[0] Then ExitLoop
        $text = ""Successful? "" & $aDevice[0] & @LF
        $text &= ""Device (Adapter or Monitor): "" & $aDevice[1] & @LF
        $text &= ""Description (Adapter or Monitor): "" & $aDevice[2] & @LF
        $text &= ""Device State Flag: "" & $aDevice[3] & @LF
        Select
            Case BitAND($aDevice[3], 32) = 32
                $text &= @TAB & ""- The device has more display modes than its output devices support"" & @LF
                ContinueCase
            Case BitAND($aDevice[3], 16) = 16
                $text &= @TAB & ""- The device is removable; it cannot be the primary display"" & @LF
                ContinueCase
            Case BitAND($aDevice[3], 8) = 8
                $text &= @TAB & ""- The device is VGA compatible"" & @LF
                ContinueCase
            Case BitAND($aDevice[3], 4) = 4
                $text &= @TAB & ""- Represents a pseudo device used to mirror application drawing for remoting"" & @LF
                ContinueCase
            Case BitAND($aDevice[3], 2) = 2
                $text &= @TAB & ""- The primary desktop is on the device"" & @LF
                ContinueCase
            Case BitAND($aDevice[3], 1) = 1
                $text &= @TAB & ""- The device is part of the desktop"" & @LF
        EndSelect
        $text &= ""Plug and Play identifier string: "" & $aDevice[4] & @LF
        MsgBox(0, """", $text)
        $i += 1
    WEnd
EndFunc   ;==>_Main

_Main_NEW()

Func _Main_NEW()
    Local $aDevice, $i = 0, $text
    While 1
        $aDevice = _WinAPI_EnumDisplayDevices("""", $i)
        If Not $aDevice[0] Then ExitLoop
        $text = ""Successful? "" & $aDevice[0] & @LF
        $text &= ""Device (Adapter or Monitor): "" & $aDevice[1] & @LF
        $text &= ""Description (Adapter or Monitor): "" & $aDevice[2] & @LF
        $text &= ""Device State Flag: "" & $aDevice[3] & @LF
        if BitAND($aDevice[3], 32) then $text &= @TAB & ""- The device has more display modes than its output devices support"" & @LF
		if BitAND($aDevice[3], 16) then $text &= @TAB & ""- The device is removable; it cannot be the primary display"" & @LF
		if BitAND($aDevice[3], 8) then $text &= @TAB & ""- The device is VGA compatible"" & @LF
		if BitAND($aDevice[3], 4) then $text &= @TAB & ""- Represents a pseudo device used to mirror application drawing for remoting"" & @LF
		if BitAND($aDevice[3], 2) then $text &= @TAB & ""- The primary desktop is on the device"" & @LF
		if BitAND($aDevice[3], 1) then $text &= @TAB & ""- The device is part of the desktop"" & @LF
        $text &= ""Plug and Play identifier string: "" & $aDevice[4] & @LF
        MsgBox(0, """", $text)
        $i += 1
    WEnd
EndFunc   ;==>_Main"	Bug	closed	3.3.1.2	Documentation	3.3.0.0	None	Fixed		
