; ; - = GetSystemMetrics demo = - ; ; Runs GetSystemMetrics with all possible values that are defined in Autoit ; #include ; Get all SM_* const's listed in WindowsConstants.au3 $SM_AllKnowValues = StringRegExp( _ _AutoIT_IncludeFile_Load("WindowsConstants.au3"), _ "\$(SM_\w+)\s*=\s*(0x)?(\d+)", _ $STR_REGEXPARRAYGLOBALFULLMATCH _ ) $HelpUrl = "https://msdn.microsoft.com/en-us/library/ms724385(VS.85).aspx" #include ;~ GetNShowData () AdlibRegister( GetNShowData ) Sleep(500) Func GetNShowData() local $OutputLines[0][4];=[["-", "-", "-","-"]] For $i = 0 To UBound($SM_AllKnowValues) - 1 Local $aMatch = $SM_AllKnowValues[$i] $SM_Name = $aMatch[1] $IsHex = $aMatch[2] $SM_Value= $aMatch[3] $SM_Value= $IsHex? dec($SM_Value): $SM_Value $ret= _WinAPI_GetSystemMetrics($SM_Value) $OutputLine = StringFormat( _ "%2i -> %-23s => %5i [ 0x%.3x ]" & _ " - %s#%s\n" , _ $SM_Value, $SM_Name, $ret, $ret, _ $HelpUrl, $SM_Name ) ConsoleWrite ($OutputLine) local $ArrLine[][]= [[ _ $SM_Value, $SM_Name, $ret, StringFormat( "0x%.3x", $ret) ]] $Header = "Value|SM_Name|RetVal|RetVal" _ArrayAdd( $OutputLines, $ArrLine ) Next Const $ArrayDisplay_ColumnNoRow = 0x40 Const $ArrayDisplay_ColumnTextAlignRight = 0x2 _ArrayDisplay($OutputLines,"GetSystemMetrics Return Values","", _ $ArrayDisplay_ColumnNoRow + $ArrayDisplay_ColumnTextAlignRight,"", _ $Header, -1 , 0 , _UserFunc ) EndFunc Func _UserFunc($aArray_2D, $aSelected) $itemIndex = $aSelected[1] $SM_Name = $aArray_2D [$itemIndex] [1] $url = StringFormat("%s#%s", $HelpUrl, $SM_Name) ShellExecute($url) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $url = ' & $url & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndFunc ;==>_UserFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _AutoIT_IncludeFile_Load ; Description ...: Loads a file frim the AutoIT Include ; Syntax ........: _AutoIT_IncludeFile_Load($IncludeName) ; Parameters ....: $IncludeName - *.au3 Include Filename ; Return values .: Success: FileContent (@extended Bytes Read) ; Failure: sets @error = 1 ; Author ........: YourRobinson1Name ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _AutoIT_IncludeFile_Load($IncludeName) $Path_Au3File = @AutoItExe & "\..\Include\" & $IncludeName $Ret = _myFileRead( $Path_Au3File ) Return SetError(@error, @extended, $Ret ) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _myFileRead ; Description ...: a wapper for FileRead(...) ; incase of an error an inputbox apperars, allowing the user to correct the path ; Syntax ........: _myFileRead($TheFile) ; Parameters ....: $TheFile - The file to read. ; Return values .: Success: FileContent ; Failure: sets @error = 1 ; Author ........: Robinson1 ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _myFileRead( $TheFile, $Count = -1) while True $Ret = FileRead( $TheFile, $Count) if @extended > 0 Then Return SetError( @error, @extended, $Ret) Else $TheFile = InputBox( "Error: FileRead returned " & @error, _ "Please edit the path:", $TheFile) if $TheFile = "" Then _ Return SetError (1) EndIf WEnd EndFunc