Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 07, 2016, 06:15:35 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: MoveInactiveWin  (Read 2368 times)

CrawlerBrinx

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
MoveInactiveWin
« on: October 08, 2012, 12:05:10 PM »
I just discovered this small utility for myself and it's totally awesome!
However, it has a small bug: it works with an active window just as fine as with inactive ones, and that's wrong.
Please, fix it.

CrawlerBrinx

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
Re: MoveInactiveWin
« Reply #1 on: October 11, 2012, 05:02:49 AM »
Some progress achieved:
(thanks to Creature.ws)
Spoiler
!LButton::KDE_WinMove("LButton")
 
KDE_WinMove(sButton)
{
    if !GetKeyState(sButton, "P")
        Exit
 
    SetWinDelay, 0
    CoordMode, Mouse
    MouseGetPos, x1, y1, id
    WinExist("ahk_id" . id)
 
    if WinActive()
        Exit
 
    WinGetClass, winClass
    if (winClass == "WorkerW")
        Exit
 
    WinGet, win, MinMax
    if (win)
        Exit
 
    WinGetPos, winX1, winY1
    while GetKeyState(sButton, "P")
    {
        MouseGetPos, x2, y2
        x2 -= x1, y2 -= y1, winX2 := winX1 + x2, winY2 := winY1 + y2
        WinMove,,, winx2, winY2
        Sleep 15
    }
}

This script now doesn't move the active window, but you can't now highlight a text in the browser while holding ALT.
« Last Edit: October 11, 2012, 05:10:11 AM by CrawlerBrinx »

CrawlerBrinx

  • Participant
  • Joined in 2012
  • *
  • default avatar
  • Posts: 17
    • View Profile
    • Donate to Member
Re: MoveInactiveWin
« Reply #2 on: October 11, 2012, 10:19:28 AM »
The code in the previous message broke alt + drag in the inactive window completely.
Ultimate version
#if !WinUnderMousePointerActive()
    !Lbutton::KDE_WinMove("Lbutton")
#if
 
WinUnderMousePointerActive()
{
    MouseGetPos,,, hWnd
    return WinActive("ahk_id" hWnd)
}
 
KDE_WinMove(sButton)
{
    if !GetKeyState(sButton, "P")
        Exit
 
    CoordMode, Mouse
    MouseGetPos, x1, y1, id
    WinExist("ahk_id" . id)
 
    WinGetClass, winClass
    if (winClass == "WorkerW" || winClass == "Progman")
        Exit
 
    WinGet, win, MinMax
    if (win)
        Exit
 
    SetWinDelay, 0
    WinGetPos, winX1, winY1
    while GetKeyState(sButton, "P")
    {
        MouseGetPos, x2, y2
        x2 -= x1, y2 -= y1, winX2 := winX1 + x2, winY2 := winY1 + y2
        WinMove,,, winx2, winY2
        Sleep 15
    }
}
code by creature.ws