Jump to content

Search the Community

Showing results for tags 'scaling'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 4 results

  1. This one has me baffled. I can't seem to get MouseMove to work properly with scaling in some windows. Run this program and use the arrow keys to move the mouse Up, Down, Left, Right at native (100%) scaling and it works as expected. Now go to 125%, for example, and move Up, Down, Left, Right on the desktop and it works. Now open the MouseMove help window (cursor on MouseMove then F1). Move the mouse into the MouseMove help window and try Up, Down, Left, Right and the movements are diagonal! If you move, for example, right from desktop into the MouseMove window it goes from moving right to down and right (diagonal) as soon as the mouse hits the MouseMove help window. I'm stumped. How do I get MouseMove to work properly? Any hints appreciated. ; ;#AutoIt3Wrapper_run_debug_mode=Y ; use this to debug in console window <--- LOOK ;Trying to figure out how to scale properly for MouseMove - moving mouse in Up, Down, Left, Right moves diagonally on some windows if scale <> 1 (100%). ;Test on main monitor and use 1920x1080 then scale to 125% as simple example. ;To change display scale in Windows 10, right click on desktop "Display Settings" --> Scale and layout ;arrow keys on arrow keypad HotKeySet("{UP}", "__UpMouse") HotKeySet("{DOWN}", "__DownMouse") HotKeySet("{LEFT}", "__LeftMouse") HotKeySet("{RIGHT}", "__RightMouse") ;v2g - cutting out superfluous code to show issue, added scaling Opt("MouseCoordMode",1) ;1 = absolute screen coordinates (default) - use this because otherwise active window mucks it up $scale = _GetScale() MsgBox(0,"DEBUG", "$scale = " & $scale) While 1 ;watch the console - the mouse is not moving correctly Sleep(10) ;this works well and does not appear to use the CPU WEnd ;================= Functions ================== Func __UpMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]+0, $mousepos[1]-1) $mouseposafter = MouseGetPos() ConsoleWrite("in __UpMouse()" & @CRLF & "Before UP (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After UP (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func __DownMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]+0, $mousepos[1]+1) $mouseposafter = MouseGetPos() ConsoleWrite("in __DownMouse()" & @CRLF & "Before DOWN (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After DOWN (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func __LeftMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]-1, $mousepos[1]+0) $mouseposafter = MouseGetPos() ConsoleWrite("in __LeftMouse()" & @CRLF & "Before LEFT (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After LEFT (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func __RightMouse() Local $mousepos, $mouseposafter $mousepos = MouseGetPos() MouseMove($mousepos[0]+1, $mousepos[1]+0) $mouseposafter = MouseGetPos() ConsoleWrite("in __RightMouse()" & @CRLF & "Before RIGHT (x,y) = " & $mousepos[0] & "," & $mousepos[1] & @CRLF & " After RIGHT (x,y) = " & $mouseposafter[0] & "," & $mouseposafter[1] & @CRLF & @CRLF) EndFunc Func _GetScale() ;returns a scale factor for PixelGetColor ;from: https://www.autoitscript.com/forum/topic/156251-mouse-coordinates/?tab=comments#comment-1130002 $tDEVMODE = DllStructCreate('byte[32];dword[10];byte[32];dword[6]') $pDEVMODE = DllStructGetPtr($tDEVMODE) $i = 0 while 1 $ret = DllCall('user32.dll', 'int', 'EnumDisplaySettings', 'ptr', 0, 'dword', $i, 'ptr', $pDEVMODE) if ($ret[0] = 0) then exitloop $width = DllStructGetData($tDEVMODE, 4, 2) ; native width $i += 1 wend $scale = $width / @DesktopWidth Return($scale) EndFunc
  2. Hello, I want to use the "_ChangeScreenResEx()" UDF for changing my display settings from 1680*1050 to 1280*800. When I use it the display change to 1280*800 but with Intel Drivers, Scaling option change : Maintain display Scaling become Center Image. Here my Main program #include <.\_ChangeResolutionEx.au3> Global $Config = @ScriptDir & "\ChangeResolution.ini" Global $aSection = IniReadSectionNames($Config) Global $Moniteur,$Largeur,$Hauteur,$Profondeur,$Refresh for $i = 1 to $aSection[0] Step 1 $Moniteur = Number($i) $Largeur = Number(IniRead($Config,$i,"Width","1680")) $Hauteur = Number(IniRead($Config,$i,"Height","1050")) $Profondeur = Number(IniRead($Config,$i,"Bits","32")) $Refresh = Number(IniRead($Config,$i,"Refresh","60")) _ChangeScreenResEx($Moniteur,$Largeur,$Hauteur,$Profondeur,$Refresh) Sleep(1000) Next _ChangeScreenResEx() #include-once ;=============================================================================== ; Function Name: _ChangeScreenResEx() ; Description: Changes the current screen geometry, colour and refresh rate. ; Version: 1.0.0.0 ; Parameter(s): $i_DisplayNum - Display to change, starting at 1 ; $i_Width - Width of the desktop screen in pixels. (horizontal resolution) ; $i_Height - Height of the desktop screen in pixels. (vertical resolution) ; $i_BitsPP - Depth of the desktop screen in bits per pixel. ; $i_RefreshRate - Refresh rate of the desktop screen in hertz. ; Requirement(s): AutoIt Beta > 3.1 ; Return Value(s): On Success - Screen is adjusted, @ERROR = 0 ; On Failure - sets @ERROR = 1 ; Forum(s): ; Author(s): Original code - psandu.ro, PartyPooper ; Modifications - bobchernow ;=============================================================================== Func _ChangeScreenResEx($i_DisplayNum = 1, $i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $DISP_CHANGE_RESTART = 1 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $HWND_BROADCAST = 0xffff Local Const $WM_DISPLAYCHANGE = 0x007E If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth; default to current setting If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight; default to current setting If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth; default to current setting If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh; default to current setting Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]") Local $s_Display $s_Display = "\\.\Display" & $i_DisplayNum Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "int", 0, "ptr", DllStructGetPtr($DEVMODE)) If @error Then $B = 0 SetError(1) Return $B Else $B = $B[0] EndIf If $B <> 0 Then DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5) DllStructSetData($DEVMODE, 4, $i_Width, 2) DllStructSetData($DEVMODE, 4, $i_Height, 3) DllStructSetData($DEVMODE, 4, $i_BitsPP, 1) DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5) $B = DllCall("user32.dll", "int", "ChangeDisplaySettingsEx","str", $s_Display, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "dword", $CDS_TEST, "lparam", 0) If @error Then $B = -1 Else $B = $B[0] EndIf Select Case $B = $DISP_CHANGE_RESTART $DEVMODE = "" Return 2 Case $B = $DISP_CHANGE_SUCCESSFUL DllCall("user32.dll", "int", "ChangeDisplaySettingsEx","str", $s_Display, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "dword", $CDS_UPDATEREGISTRY, "lparam", 0) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) $DEVMODE = "" Return 1 Case Else $DEVMODE = "" SetError(1) Return $B EndSelect EndIf EndFunc;==>_ChangeScreenResEx Any idea how to get around this problem ? thanks for your answer.
  3. I have encountered that the font weight does not seem to scale the way I would have expected. The degree of "bold" does not always increase with the weight value but even reverses e.g. 700 being less bold than 600 ? Does anyone have an idea? Code and screenshot below. Cheers #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $f_size = 9 Local $h_win = GUICreate ( "TEST GUI ... FONT weight", 400, 350) GUISetBkColor(0xffffff, $h_win) GUISetFont(10, 400, 0, "Arial", $h_win, 2) GUICtrlCreateLabel("Test FONT weight ...", 10, 10) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 200)", 10, 60, 380, 20) GUICtrlSetFont(-1, $f_size, 200) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 400)", 10, 90, 380, 20) GUICtrlSetFont(-1, $f_size, 400) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 500)", 10, 120, 380, 20) GUICtrlSetFont(-1, $f_size, 500) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 600)", 10, 150, 380, 20) GUICtrlSetFont(-1, $f_size, 600) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 700)", 10, 180, 380, 20) GUICtrlSetFont(-1, $f_size, 700) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 800)", 10, 210, 380, 20) GUICtrlSetFont(-1, $f_size, 800) GUICtrlSetColor(-1, 0x000099) GUICtrlCreateLabel("The quick brown fox jumps over ... (weight = 900)", 10, 240, 380, 20) GUICtrlSetFont(-1, $f_size, 900) GUICtrlSetColor(-1, 0x000099) Local $button = GUICtrlCreateButton("Close", 160, 310, 80, 20) GUISetState(@SW_SHOW) While 1 Local $msg_pop = GUIGetMsg() Select Case $msg_pop = $GUI_EVENT_CLOSE ExitLoop Case $msg_pop = $button ExitLoop EndSelect WEnd GUIDelete() EndFunc
  4. Is it possible to resize a window without jsut making it bigger, but make the sides moving outwards / inwards to resize the window.
×