[Mod]Col4Dragger: An Option to move the Top-Right multipurpose window

Barra

Warlord
Joined
Oct 22, 2014
Messages
115
First things first, Thank you for the great 4.0 Update.

The multipurpose window, used f.e. in Go-To or to choose a students profession, showing the Story snippets etc. , is always appearing in the top right.
This is somehow unconvenient for me, is there an option to let it anchor in the middle of the screen ?!
Is it possible at all to set alternate coordinates for this window.
If so, do you have a hint in which files I have to look for?
Is it basically always the same window or are different windows used but all have the same anchor point set? Or in other words, do these windows share one anchor point or does each window set its own anchor point but currently its for each, the top right ?
 
You are looking for CvDLLButtonPopup, where the size and location is sadly set inside the exe. As a result, so far nobody have been successful in changing either location or size. It has been high on my wishlist for ages to such a degree that I have considered rewriting the entire window code from scratch just to be the size into our own code.
 
Thanks for your reply.
I already suspected something like this...

For those interested in a workaround, here is a very basic autoit script:


Spoiler AutoIT Move Top Right Multipurpose Window :

CSS:
; Press Shift-Alt-d to terminate script
#include <AutoItConstants.au3>
HotKeySet("!x", "MoveIt") ;ALT+x
HotKeySet("+!d", "Terminate") ; Shift-Alt-d

While 1
    Sleep(100)
    ;ToolTip("Script is Paused",0,0)
 WEnd
 
 
 Func MoveIt()

$MousePos = MouseGetPos()
$MousePos[0] ; Mouse X position
$MousePos[1] ; Mouse Y position

MouseClickDrag ( $MOUSE_CLICK_LEFT, 2013, 74, 1217, 287 ) ; numbers 1 and 2 start position for begin drag, 3 and 4 and position to release drag, it varies for each user dependend on screen resolution and size
MouseMove($MousePos[0], $MousePos[1], 1 )  ; after drag action, bring back mouse to position when the hotkey was pressed

EndFunc
  
  
Func Terminate()
    Exit
EndFunc
 
Last edited:
Here is a more evolved Version Col4Dragger 0.9,

it supports 720p, 1080p and 1440p resolutions and does automatically drag the top right window(s) to a more convenient position.

This happens almost instantly and works surprisingly well

It could be used to start the game and/or while already ingame.

This autoit script has to be put in the working directory of colonization.exe

If you want to, you can compile it to an exe too, so the user doesnt need to have AutoIt nor SetDPI installed (after compile)

Its independent from the mod itself. So as long as the multipurpose window spawns on the given position (as of WTP 4.0.2 ), it will work.
Its tested in Win10, 100% display scaling, nativ 1440p and nativ 1080p, 720p should work without issues too.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Because its using pixelcolor to recognize a window its needed to set Windows display scaling

This can be done manually or
by placing this DPIScale command into colo4 main folder

If DpiSet is used, it will change the display scaling of the main screen, from whatever to 100% and setting it back to whatever as soon as the game is closed.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Spoiler Col4Dragger :

Less:
#include <AutoItConstants.au3>
#include <WinAPI.au3>

;~ #RequireAdmin ;when active mouse and kb input is blocked while dragging

FileInstall("SetDpi.exe", @TempDir & "\SetDpi.exe") ; optional SetDpi

HotKeySet("+!d", "Terminate") ; Shift-Alt-D

Local $qhd = ("2560")
Local $fhd = ("1920")
Local $hd = ("1280")

Global $scale = _WinAPI_EnumDisplaySettings('', $ENUM_CURRENT_SETTINGS)[0] / @DesktopWidth
;ConsoleWrite("Scale = " & _WinAPI_EnumDisplaySettings('', $ENUM_CURRENT_SETTINGS)[0] & " / " & @DesktopWidth & " = " & $scale & @CRLF)

If $scale > 1 Then    ; optional SetDpi
run (@TempDir & "\SetDpi.exe 100") ; optional SetDpi
EndIf ; optional SetDpi

If not ProcessExists("Colonization.exe") Then
    Run("Colonization.exe","")
    sleep(30000)
EndIf


ProcessWait ("Colonization.exe")


While ProcessExists("Colonization.exe")
 
    Sleep(50)

    If WinActive("Colonization") Then
        Local $sRes = WinGetPos ("[Active]")
        ;ConsoleWrite("Used Resolution: " & $sRes[2] & "x" & $sRes[3] & @LF)
 
;~                 Local $cOLOR = PixelSearch ( 879, 77, 1232, 80, 9856307) ;                                        debug block to find a color all resolutions share
;~                 If Not @error Then  
;~                 ConsoleWrite("Found the color at: x:" & $Color[0] & " y:"& $Color[1] & @LF)
;~                 Else
;~                 ConsoleWrite("Could not found any gold" & @LF)
;~                 EndIf
  
        If $sRes[2] = $qhd then
 
            Local $iColor = PixelGetColor(2204, 79, 0) ;1440p
            ;ConsoleWrite("The color is:" & $iColor & @LF)

                If $iColor = ("9856307") Then ;the golden top border of the window
                    BlockInput($BI_DISABLE) ;only works with active "RequireAdmin", if not "RequireAdmin" it just does not block
                    _MouseDragFast2(2204, 79, 1180, 480)
                    MouseMove(1487,569,1)
                    BlockInput($BI_ENABLE)
                EndIf
 
        ElseIf $sRes[2] = $fhd then

            Local $iColor = PixelGetColor(1874, 79, 0) ;1080p

                If $iColor = ("9856307") Then
                    BlockInput($BI_DISABLE)
                    _MouseDragFast2(1874, 81, 1177, 281)
                    MouseMove(1178,363,1)
                    BlockInput($BI_ENABLE)
                EndIf
  
        ElseIf $sRes[2] = $hd then

            Local $iColor = PixelGetColor(924, 79, 0) ;720p

                If $iColor = ("9856307") Then
                    BlockInput($BI_DISABLE)
                    _MouseDragFast2(924, 79, 630, 140)
                    MouseMove(941,224,1)
                    BlockInput($BI_ENABLE)
                EndIf
  
        Else
            ConsoleWrite("Unsupported Resolution" & @LF)
        EndIf
    EndIf
WEnd


Run (@TempDir & "\SetDpi.exe " & $scale*100); optional SetDpi


Func _MouseDragFast($x, $y,$x2,$y2)
    $x = $x*65535/@DesktopWidth
    $y = $y*65535/@DesktopHeight
    $x2 = $x2*65535/@DesktopWidth
    $y2 = $y2*65535/@DesktopHeight

    _WinAPI_Mouse_Event(BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_MOVE), $x, $y)
    _WinAPI_Mouse_Event(BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTDOWN), $x, $y)
    _WinAPI_Mouse_Event(BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_MOVE), $x2, $y2)
    _WinAPI_Mouse_Event(BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTUP), $x2, $y2)
EndFunc


Func _MouseDragFast2($x, $y, $x2, $y2, $User32 = "User32.dll")
    $x_koef = 65535/@DesktopWidth
    $y_koef = 65535/@DesktopHeight
    $User32 = DllOpen("User32.dll")
 
    $x *= $x_koef
    $y *= $y_koef
    $x2 *= $x_koef
    $y2 *= $y_koef
 
    DllCall($User32, "none", "mouse_event", "int", 32769, "int", $x, "int", $y, "int", 0, "int", 0) ; 32769 0x8001 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_MOVE)
    DllCall($User32, "none", "mouse_event", "int", 32770, "int", $x, "int", $y, "int", 0, "int", 0) ; 32770 0x8002 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTDOWN)
    DllCall($User32, "none", "mouse_event", "int", 32769, "int", $x2, "int", $y2, "int", 0, "int", 0) ; 32769 0x8001 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_MOVE)
    DllCall($User32, "none", "mouse_event", "int", 32772, "int", $x2, "int", $y2, "int", 0, "int", 0) ; 32772 0x8004 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTUP)
EndFunc

Func Terminate()
    Run (@TempDir & "\SetDpi.exe " & $scale*100); optional SetDpi
    Exit
EndFunc
 

Attachments

  • Col4Dragger0.9.zip
    794.2 KB · Views: 17
Last edited:
Bump, interesting for everyone with a widescreen +27inch i would say :)
 
Top Bottom