vip88 Posted February 6, 2021 Share Posted February 6, 2021 If (x,y) is given by AU3Info tool, PixelGetColor(x,y) return value is not correct. But if (x,y) is given by ColorPicker( https://annystudio.com/software/colorpicker/ ),the return value is correct. How to solve this issue? Thank you. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 6, 2021 Developers Share Posted February 6, 2021 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
argumentum Posted February 6, 2021 Share Posted February 6, 2021 (edited) 4 hours ago, vip88 said: If (x,y) is given by AU3Info tool, PixelGetColor(x,y) return value is not correct. I use https://www.autoitscript.com/forum/files/file/478-control-viewer-mod/ I can lock in CV the "Browse tool"/"Finder tool" by right and left click simultaneously. While locked in CV, I dragged the AU3Info's "Finder tool" to see if the values are not the same, but they are the same. Look at the "Coord Mode" and make sure that is in the same mode as in the other color picker (Screen/Window/Client). Edit: I've downloaded the program ( jcpicker ) and found no discrepancies. Edited February 6, 2021 by argumentum dig deeper Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 6, 2021 Moderators Share Posted February 6, 2021 vip88, Very often these discrepancies are the result of having your display scaling set to something other than 100%, so I suggest you check your machine and see if that is the case. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
argumentum Posted February 7, 2021 Share Posted February 7, 2021 (edited) On 2/6/2021 at 7:22 AM, Melba23 said: Very often these discrepancies are the result of having your display scaling set to something other than 100% Yes. Here is code to save the day: expandcollapse popup;;; https://www.autoitscript.com/forum/topic/205086-get-screen-width-and-height-but-not-the-same-as-os-moved/?tab=comments#comment-1474562 ;~ #include <WinAPISys.au3> ;~ ConsoleWrite(@DesktopWidth & "x" & @DesktopHeight & @CRLF) ; 2560x1080 ; 2048x864 @ 125% ;~ ConsoleWrite( _WinAPI_GetSystemMetrics(0) & "x" & _WinAPI_GetSystemMetrics(1) & @CRLF) ; 2560x1080 ; 2048x864 @ 125% ;~ ConsoleWrite( _WinAPI_GetSystemMetrics(78) & "x" & _WinAPI_GetSystemMetrics(79) & @CRLF) ; 3760x1920 ; 3760x1920 @ 125% on monitor 1 #include <WinAPIGdi.au3> ; enum _PROCESS_DPI_AWARENESS Global Const $PROCESS_DPI_UNAWARE = 0 Global Const $PROCESS_SYSTEM_DPI_AWARE = 1 Global Const $PROCESS_PER_MONITOR_DPI_AWARE = 2 ; enum _MONITOR_DPI_TYPE Global Const $MDT_EFFECTIVE_DPI = 0 Global Const $MDT_ANGULAR_DPI = 1 Global Const $MDT_RAW_DPI = 2 Global Const $MDT_DEFAULT = $MDT_EFFECTIVE_DPI Global $g_hGUI, $g_iLeft = -1, $g_iTop = -1, $g_iDpi = $PROCESS_PER_MONITOR_DPI_AWARE ParseCmdLine() _WinAPI_SetProcessDpiAwareness($g_iDpi) _Example() Func _Example() ; https://www.autoitscript.com/forum/topic/189341-get-per-monitor-dpi-scaling-factor/ $g_hGUI = GUICreate(@ScriptName, 600, 400, $g_iLeft, $g_iTop) Local $idEdit = GUICtrlCreateEdit("", 0, 30, 600, 370) GUICtrlSetFont(-1, 10) Local $idBttn0 = GUICtrlCreateButton("Reload as DPI_UNAWARE", 5, 2, 195, 25) GUICtrlSetFont(-1, 10) Local $idBttn1 = GUICtrlCreateButton("Reload as SYSTEM_DPI_AWARE", 205, 2, 195, 25) Local $idBttn2 = GUICtrlCreateButton("Reload as PER_MONITOR_DPI", 405, 2, 195, 25) Local $aMonitors = _WinAPI_EnumDisplayMonitors() If Not IsArray($aMonitors) Then Exit MsgBox(0, "", "EnumDisplayMonitors error") Local $sDPIs, $aDPI For $i = 1 To $aMonitors[0][0] $aDPI = _WinAPI_GetDpiForMonitor($aMonitors[$i][0], $MDT_DEFAULT) $sDPIs &= "DpiForMonitor #" & $i & @TAB & (IsArray($aDPI) ? $aDPI[0] & ":" & $aDPI[1] : " error" ) & @CRLF Next GUICtrlSetData($idEdit, $sDPIs & "==================================" & @CRLF, 1) GUICtrlSetData($idEdit, FileRead(@ScriptFullPath), 1) GUISetState() While 1 Switch GUIGetMsg() Case -3 GUIDelete() Exit Case $idBttn0 runAnew($PROCESS_DPI_UNAWARE) Case $idBttn1 runAnew($PROCESS_SYSTEM_DPI_AWARE) Case $idBttn2 runAnew($PROCESS_PER_MONITOR_DPI_AWARE) EndSwitch WEnd EndFunc ;==>_Example Func runAnew($iDpi) Local $aArray = WinGetPos($g_hGUI) ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" ' & $aArray[0] & '/' & $aArray[1] & '/' & $iDpi) GUIDelete() Exit EndFunc Func ParseCmdLine() Local $a[4] = [3,-1,-1,0] For $n = 1 To $CmdLine[0] $a = StringSplit($CmdLine[$n], '/') If UBound($a) = 4 Then $g_iLeft = $a[1] $g_iTop = $a[2] $g_iDpi = Int($a[3]) Return EndIf Next EndFunc Func _WinAPI_SetProcessDpiAwareness($DPIAware) DllCall("Shcore.dll", "long", "SetProcessDpiAwareness", "int", $DPIAware) If @error Then Return SetError(1, 0, 0) EndFunc ;==>_WinAPI_SetProcessDpiAwareness Func _WinAPI_GetDpiForMonitor($hMonitor, $dpiType) Local $X, $Y Local $aRet = DllCall("Shcore.dll", "long", "GetDpiForMonitor", "long", $hMonitor, "int", $dpiType, "uint*", $X, "uint*", $Y) If @error Or Not IsArray($aRet) Then Return SetError(1, 0, 0) Local $aDPI[2] = [$aRet[3], $aRet[4]] Return $aDPI EndFunc ;==>_WinAPI_GetDpiForMonitor Edit: ..I find this code a better exploration Edited March 18, 2021 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now