Jump to content
Sign in to follow this  
Cusem

Coordmodes and Window "frame"

Recommended Posts

Cusem

I making a function that will get the coordinates of a rectangle on screen by clicking the left-top corner once, followed by clicking the right-bottom corner.

This selecting a rectangle for the PixelChecksum command.

While 1
    If _Ispressed(01) = 1 Then 
        $pos1 = MouseGetPos()
        SoundPlay(@WindowsDir&"\Media\Ding.wav")
        ExitLoop
    EndIf
WEnd
Sleep(350)
While 1
    If _Ispressed(01) = 1 Then 
        $pos2 = MouseGetPos()
        SoundPlay(@WindowsDir&"\Media\Ding.wav")
        $left=$pos1[0]
        $top=$pos1[1]
        $right=$pos2[0]
        $bottom=$pos2[1]
        $width=$pos2[0]-$pos1[0]
        $height=$pos2[1]-$pos1[1]
        ExitLoop
    EndIf
WEnd

However, I want to display what i've "selected".

Everything went fine, except when I changed the PixelCoordMode from 1 to 2.

I do this with:

Local $cw = WinGetPos($windowname)
    GUICreate ("",$width, $height, $left + $cw[0], $top + $cw[1], $WS_POPUP,$WS_EX_TOOLWINDOW)
    GUISetBkColor(0x00FF00)
    GUISetState()
    Sleep(1000)
    GUIDelete()

It seems that $cw[0] and $cw[1] is were the "frame" (don't know what it's called. I mean the titlebar etc.) of the target window begins. However, I want the coordinates were the content of the window is positioned, so withouth the titlebar.

Anyone knows a way to do this?

(I hope you guys get what I mean, since my English isn't marvellous :) )

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×