Jump to content

Simple TitleBar RollUp programm


Alexz
 Share

Recommended Posts

First off all thank You Larry and Ezzetabi.

My programm based on Yours code.

This is simple programm, but could be usefull for somebody.

When You click on window title, window rollup or rolldown.

AutoItSetOption ("MouseCoordMode", 0)

Global $hwnd, $title
Global $Win_HWND[100], $Win_Size[100]

$wCount = 0
$hwnd = WinGetHandle("")
$title = WinGetTitle($hwnd)

While 1
  ;------------- One Left mouse click detect-----------------
   If _IsPressed('01') = 1  Then   ; LEFT Click
      Sleep(250)
      If _IsPressed('01') = 0  Then   ; LEFT Click Release -> RollUp
         $pos = MouseGetPos()
         If $pos[0] > 22 AND $pos[1] < 25 Then CheckHWND($hwnd)
      Else
         While _IsPressed('01')
            Sleep(250)
         WEnd
      EndIf
   EndIf
  ;-----------------------------------------------------------
   SetTitle($hwnd,$title)
   $newhwnd = WinGetHandle("")
   If Not @Error And $newhwnd <> $hwnd Then
      WinSetTitle($hwnd,"",$title)
      $hwnd = $newhwnd
      $title = WinGetTitle($hwnd)
   EndIf
   Sleep(200)
WEnd
;-------------------------------
Func SetTitle($h,$t)
   WinSetTitle($h,"",$t & " < " & @hour & ":" & @min & ":" & @sec & " >")
EndFunc
;-------------------------------
Func CheckHWND($hwnd)
   $hwnd = WinGetHandle("")
   $size = WinGetPos("")
   If $size[3] = 27 then
      For $count = 0 to $wCount
         If $Win_HWND[$count] = $hwnd Then
            $size[3] = $Win_Size[$count]
            WinMove($hwnd, "", $size[0], $size[1], $size[2], $size[3])
            $Win_HWND[$count] = $Win_HWND[$wCount]
            $Win_Size[$count] = $Win_Size[$wCount]
            $wCount = $wCount - 1
            ExitLoop
         EndIf
      Next
   Else
      $Win_HWND[$wCount] = $hwnd
      $Win_Size[$wCount] = $size[3]
      $wCount = $wCount + 1
      WinMove($hwnd, "", $size[0], $size[1], $size[2], 27)
   EndIf
EndFunc
;-------------------------------
Func OnAutoItExit()
   WinSetTitle($hwnd,"",$title)
   For $count = 0 to $wCount
      $hwnd = $Win_HWND[$count]
      WinActivate($hwnd)
      $size = WinGetPos("")
      $size[3] = $Win_Size[$count]
      WinMove($hwnd, "", $size[0], $size[1], $size[2], $size[3])
   Next
   AutoItSetOption ("MouseCoordMode", 1)
   Exit
EndFunc
;-------------------------------
Func _IsPressed($hexKey)
  Local $aR, $bRv   ;$hexKey
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If $aR[0] <> 0 Then
     $bRv = 1
  Else
     $bRv = 0
  EndIf
  Return $bRv
EndFunc

Alexz

TitleBarClock2.au3

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...