Custom Query

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (112 - 114 of 3866)

Ticket Resolution Summary Owner Reporter
#199 Rejected Multi-Monitor Support Include File anonymous
Description

I have taken several scripts from the AutoIt form and created a WORKING include file to gather and return metrics for all active display devices on a PC. This works for 2+ monitors & returns AutoIt friendly data including Left,Top,Width,Height. It works on XP (still needs to be tested on Vista sorry).

If you have any questions or would like to see the Flash screen saver I created for 30,000+ workstations please email me thomas at caplan77 dot com.

;Include PreDefined Functions
#include-once
#include <GuiConstantsEx.au3>
#include <GUIConstants.au3>

; #INDEX# =======================================================================================================================
; Title .........: _AllMonitorMetrics
; Description ...: Determines the number of active displays and returns RECT plus AutoIt friendly width & height for each (up to 31 displays).
; Author ........: Thomas W Caplan and the AutoIt Form
; ===============================================================================================================================

; #CONSTANTS# ===================================================================================================================
Global Const $DISPLAY_DEVICE_ACTIVE = 0x00000001
Global Const $DISPLAY_DEVICE_ATTACHED = 0x00000002
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Global Const $MONITORINFO = "int;int[4];int[4];int"
Global Const $RECT = "long;long;long;long"
Global Const $DEVMODE = "byte[32];short;short;short;short;int;int[2];int;int;short;short;short;short;short;byte[32];short;ushort;int;int;int;int"
Global Const $POINTL = "long;long"
Global Const $DISPLAY_DEVICE = "int;char[32];char[128];int;char[128];char[128]"
; ===============================================================================================================================

; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
;_AllMonitorMetrics
; ===============================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name...........: _AllMonitorMetrics
; Description ...: Determines the number of active displays and returns RECT plus AutoIt friendly width & height for each (up to 31 displays).
; Syntax.........: _AllMonitorMetrics()
; Parameters ....: None
; Return values .: Success      - Returns an array with the following:
;								- [0][0] = Total Number of Monitors.
;								- [Monitor#][0] = Display Handle
;								- [Monitor#][1] = Left-Most Coordinate
;								- [Monitor#][2] = Top-Most Coordinate
;								- [Monitor#][3] = Right-Most Coordinate
;								- [Monitor#][4] = Bottom-Most Coordinate
;								- [Monitor#][5] = Display Width
;								- [Monitor#][6] = Display Height
; Author ........: Thomas W Caplan and the AutoIt Form
; Modified.......: 
; Remarks .......: Used on computers with 2+ displays. Coordinates are relative to monitor 1.
; Related .......: 
; Link ..........;	@@MsdnLink@@ EnumDisplayDevices 
;					@@MsdnLink@@ EnumDisplaySettingsEx
;					@@MsdnLink@@ MonitorFromPoint
;					@@MsdnLink@@ GetMonitorInfo
;					
; Example .......;	$displays = _AllMonitorMetrics()
;					sgBox(0,Default,"Total Number of Displays: " & $displays[0][0])
;					For $i = 1 To $displays[0][0]
;						MsgBox(0,"Display "& $i,"HWnd: "& $displays[$i][0] &@LF&" Left: "& $displays[$i][1] &@LF _
;						&" Top: "& $displays[$i][2] &@LF&" Right: "& $displays[$i][3] &@LF _ 
;						&" Bottom: "& $displays[$i][4] &@LF&" Width: "& $displays[$i][5] &@LF&" Height: "& $displays[$i][6])
;					Next
; ===============================================================================================================================
Func _AllMonitorMetrics()
	Local $intDeviceNumber, $intDeviceID
	Local $CurrentMonitorHWnd
	Local $user32dll, $StateFlag
	Local $EnumDisplaysEx, $EnumDisplays
	Local $structDeviceMode, $structDisplayDevice, $structMonitorInfo
	Local $xw,$xl,$yh,$yt,$yb,$xr
	Local $AllMonitorMetrics[32][8]
	
	$intDeviceNumber = 0
    $intDeviceID = 0
	$user32dll = DllOpen("user32.dll")
	        
    Dim $structDisplayDevice = DllStructCreate($DISPLAY_DEVICE)
    DllStructSetData($structDisplayDevice, 1, DllStructGetSize($structDisplayDevice))
    
    $EnumDisplays = DllCall($user32dll, "int", "EnumDisplayDevices", "ptr", 0, "int", $intDeviceNumber, "ptr", DllStructGetPtr($structDisplayDevice), "int", 0)
    $StateFlag = Number(StringMid(Hex(DllStructGetData($structDisplayDevice, 4)), 3))
    While $EnumDisplays[0] <> 0
        If ($StateFlag <> $DISPLAY_DEVICE_MIRRORING_DRIVER) And ($StateFlag <> 0) Then ;Ignore virtual mirror displays.
            ;Get information about the display's position and the current display mode.
            Dim $structDeviceMode = DllStructCreate($DEVMODE)
            DllStructSetData($structDeviceMode, 4, DllStructGetSize($structDeviceMode))
            $EnumDisplaysEx = DllCall($user32dll, "int", "EnumDisplaySettingsEx", "str", DllStructGetData($structDisplayDevice, 2), "int", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($structDeviceMode), "int", 0)
            If $EnumDisplaysEx[0] = 0 Then
                DllCall($user32dll, "int", "EnumDisplaySettingsEx", "str", DllStructGetData($structDisplayDevice, 2), "int", $ENUM_REGISTRY_SETTINGS, "ptr", DllStructGetPtr($structDeviceMode), "int", 0)
            EndIf
            
            ;Get the monitor handle and workspace
            Dim $CurrentMonitorHWnd
            Dim $structMonitorInfo = DllStructCreate($MONITORINFO)
            DllStructSetData($structMonitorInfo, 1, DllStructGetSize($structMonitorInfo))
            If Mod($StateFlag, 2) <> 0 Then ;$DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
                ;Display is enabled. Only enabled displays have a monitor handle.
                $CurrentMonitorHWnd = DllCall($user32dll, "hwnd", "MonitorFromPoint", "int", DllStructGetData($structDeviceMode, 7, 1), "int", DllStructGetData($structDeviceMode, 7, 2), "int", 0)
                If $CurrentMonitorHWnd[0] <> 0 Then
                    DllCall($user32dll, "int", "GetMonitorInfo", "hwnd", $CurrentMonitorHWnd[0], "ptr", DllStructGetPtr($structMonitorInfo))
                EndIf
            EndIf
			
            ;Format RECT information about this monitor.
            If $CurrentMonitorHWnd[0] <> 0 Then
				$intDeviceID += 1
                $AllMonitorMetrics[$intDeviceID][0] = $CurrentMonitorHWnd[0]
                $AllMonitorMetrics[$intDeviceID][1] = DllStructGetData($structMonitorInfo, 2, 1) ;X-Coord Left Bound
                $AllMonitorMetrics[$intDeviceID][2] = DllStructGetData($structMonitorInfo, 2, 2) ;Y-Coord Top Bound
				$AllMonitorMetrics[$intDeviceID][3] = DllStructGetData($structMonitorInfo, 2, 3) ;X-Coord Right Bound			
                $AllMonitorMetrics[$intDeviceID][4] = DllStructGetData($structMonitorInfo, 2, 4) ;Y-Coord Bottom Bound
				$xl = DllStructGetData($structMonitorInfo, 2, 1) ;X-Coord Left Bound
				$yt = DllStructGetData($structMonitorInfo, 2, 2) ;Y-Coord Top Bound
				$xr = DllStructGetData($structMonitorInfo, 2, 3) ;X-Coord Right Bound		
				$yb = DllStructGetData($structMonitorInfo, 2, 4) ;Y-Coord Bottom Bound
								
				;Now converting RECT data into AutoIt friendly metrics: Width, Height.
				;This is tricky since this display's RECT data is positive and/or negative in relation to the main monitor.
				If $xl < 0 Then ;Left of Main Point 0,0.
					If $xr < 0 Then
						$xw = Abs(Abs($xl) - Abs($xr))
						$AllMonitorMetrics[$intDeviceID][5] = $xw
					Else
						$xw = Abs($xl) + Abs($xr)
						$AllMonitorMetrics[$intDeviceID][5] = $xw
					EndIf
				Else
					$xw = Abs(Abs($xl) - Abs($xr))
					$AllMonitorMetrics[$intDeviceID][5] = $xw
				EndIf
				If $yt < 0 Then ;Above Main Point 0,0.
					If $yb < 0 Then
						$yh = Abs(Abs($yt) - Abs($yb))
						$AllMonitorMetrics[$intDeviceID][6] = $yh
					Else
						$yh = Abs($yt) + Abs($yb)
						$AllMonitorMetrics[$intDeviceID][6] = $yh
					EndIf
				Else
					$yh = Abs(Abs($yt) - Abs($yb))
					$AllMonitorMetrics[$intDeviceID][6] = $yh
				EndIf
			EndIf
			
        EndIf
        $intDeviceNumber += 1
        
        $EnumDisplays = DllCall($user32dll, "int", "EnumDisplayDevices", "ptr", 0, "int", $intDeviceNumber, "ptr", DllStructGetPtr($structDisplayDevice), "int", 0)
        $StateFlag = Number(StringMid(Hex(DllStructGetData($structDisplayDevice, 4)), 3))
    WEnd
    
    DllClose($user32dll)
	
	;Recording the total number of monitors.
	$AllMonitorMetrics[0][0] = $intDeviceID
	
	Return $AllMonitorMetrics
EndFunc ;==>_WinAPI_AllMonitorMetrics

#202 Rejected Would like to be able to Branch on condition Everseeker
Description

Before you whack this request for a GoTo, let me explain... Consider a stack of a couple hundred records, with 50 elements in each. In a loop, pull 1 record and perform 70+ transforms on various parts of the record, including feeding data to an external application after each transformation. When done, get the next record and repeat.. all well and good, nothing new here. Now, consider the following issue: at any point in the processing, the external application can throw up a "Bad data" box. I am catching that event Via Adlib() So, Error box caught.. and, because this means the Data is bad, I can NOT process this record any more. So how do I abort the record? There is no way to "On condition, branch to the end of the loop"

The consensus in the forums is that, before each and every single statement in the loop, I have to add an "If $Abortcode="false" then condition. For 3 or 4 statement loops, that's fine, but for 70+ steps, with an average of 10 lines per step, you're talking about adding 700 lines of code. That is a bit much.... So, I am proposing as an extension of If...Ehen... Else If...Then ::Label and ::Label be added as a location marker (If you ever see some idiot use If 1=1 then ::Label, feel free to fry them in oil)

#204 Rejected GUICtrlCreateListViewItem() - new optional parameter IconIndex Zedna
Description

GUICtrlCreateListViewItem() - new optional parameter IconIndex $iImage - Zero based index of the item's icon in the control's image list

This new parameter will be optional so no backward compatibility problems.

It should be the same as it's in _GUICtrlListView_AddItem() UDF

_GUICtrlListView_AddItem($hWnd, $sText[, $iImage = -1])

$iImage - Zero based index of the item's icon in the control's image list

Maybe the same apply also for GUICtrlCreateTreeViewItem()

_GUICtrlTreeView_Add($hWnd, $hSibling, $sText[, $iImage = -1[, $iSelImage = -1]])

$iImage - Zero based index of the item's icon in the control's image list $iSelImage - Zero based index of the item's icon in the control's image list

*

Idea comes from my Log_View project (see my sig on the forum) where I create many ListView items by GUICtrlCreateListViewItem() and then I use GUICtrlSetImage(-1, @ScriptFullPath, $index) to set icon for just created ListViewItem item based on index from EXE icons in resources. But this is very slow because there is internally called ExtractIcon (fileoperations) and so on - for each item inside LOOP.

$index = ...
GUICtrlCreateListViewItem($itemtext, $ListView1)
GUICtrlSetImage(-1, @ScriptFullPath, $index)

should be

$index = ...
GUICtrlCreateListViewItem($itemtext, $ListView1, $index)

Of course at start of script will be _GUICtrlListView_SetImageList () in this case.

Note: See TracQuery for help on using queries.