guiltyking

mouse over gui

3 posts in this topic

wanted help to handle code. OnEvent Mode - transparency when mouse is out GUI.

#include <GUIConstants.au3>
#include <GUIConstants.au3>
#include <WinAPISys.au3>
;
Global $ParentWin_Width = 450,$ParentWin_Height = 400
Global $ParentWin_Left = ((@DesktopWidth - $ParentWin_Width) / 2)
Global $ParentWin_Rght = 450, $ParentWin_mn = 10
Global $Top = 0
;
Global $ParentWin = GUICreate("Example", $ParentWin_Rght, $ParentWin_Height, $ParentWin_Left, $Top, -1, $WS_EX_TOPMOST)
            GUISetBkColor(0XFFFFFF,$ParentWin )
            $Group2=GUICtrlCreateGroup('Txt2Wav', 1, 0, 199, 116)
                $Txt2Wav=GUICtrlCreateEdit('', 3, 16, 195, 92)
                    Guictrlsetcolor($Txt2Wav,0xff0000)
                    $hMainTxtBox=GUICtrlGetHandle($Txt2Wav)
                    GUICtrlSetData($hMainTxtBox, 'Text to convert...')
                ;
                $Play=GUICtrlCreateButton('Play', 0, 118, 40, 40, 0)
                GUICtrlCreateLabel('Rate:', 50, 130, 40, 20)
                $Rate=GUICtrlCreateSlider(60, 143, 60, 20)
                GUICtrlSetLimit($Rate, 10, -10)
                GUICtrlCreateLabel('Volume:', 120, 130, 40, 20)
                $Volume=GUICtrlCreateSlider(130, 143, 60, 20)
                GUICtrlSetLimit($Volume, 100, 0)
                GUICtrlSetData(-1, 100)
            GUICtrlCreateGroup('', -99, -99, 1, 1)
            ;           
GUISetState(@SW_SHOW, $ParentWin)
;
;
GUIRegisterMsg($WM_MOUSEMOVE, WM_MOUSEMOVE)
GUIRegisterMsg($WM_MOUSELEAVE, WM_MOUSELEAVE)

While 1
    If GUIGetMsg() = -3 Then Exit
    sleep(100)
WEnd

Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)   ;==>WM_MOUSEMOVE
    ToolTip("In window " & WinGetTitle($hWnd))
          WinSetTrans($ParentWin, "", 255)
    _WinAPI_TrackMouseEvent($hWnd, $TME_LEAVE)
    sleep(900)
    Return $GUI_RUNDEFMSG
EndFunc

Func WM_MOUSELEAVE($hWnd, $iMsg, $wParam, $lParam)   ;==>WM_MOUSELEAVE
    ToolTip("Left window " & WinGetTitle($hWnd))
          WinSetTrans($ParentWin, "", 170)
    Return $GUI_RUNDEFMSG
EndFunc

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

SOLVED>>>

Instant screen filter-move cursor screen right to collapse & screen top to hide screen - no gui activation required.

you can set color 0xFFF000 to have a screen filter for easy reading

#include <WindowsConstants.au3>
#include <winapiex.au3>;_WinAPI_TrackMouseEvent
;
HotKeySet("{ESC}", "_Custom_Exit")
;
Global $ParentWin_Width = @DesktopWidth,$ParentWin_Height = @DesktopHeight
Global $Top = 0, $ParentWin_Rght = 0, $ParentWin_Left = -1
Global $ParentWin_mn = 0,$sense = 40, $nSteps = 20
Global $MOUSELEAVE = 0

$form1 = GUICreate('Form1', $ParentWin_Width, $ParentWin_Height, $ParentWin_Left, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    GUICtrlCreateButton("ok", 110, 110)
    GUISetState()
    GUISetBkColor(0x000000,$form1 )

GUIRegisterMsg(0x0200, '_WM_MOUSEMOVE')
GUIRegisterMsg(0x02A3, '_WM_MOUSELEAVE')

While GUIGetMsg() <> -3
WEnd

Func _WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)  ;==>_WM_MOUSEMOVE
        If $MOUSELEAVE Then Return
        Local $win_pos = WinGetPos("Form1")
        For $i = $win_pos[1] To $win_pos[3] Step 10
                If $i >= 5 Then ExitLoop
                WinMove("Form1", "", $win_pos[0], $i, $win_pos[2], $win_pos[3])
                Sleep(10)
        Next
        _WinAPI_TrackMouseEvent($form1, $TME_LEAVE)
        $MOUSELEAVE = 1
          WinSetTrans($form1, "", 255)
EndFunc 

Func _WM_MOUSELEAVE($hWndGUI, $MsgID, $wParam, $lParam)
        $MOUSELEAVE = 0
        $a = GUIGetCursorInfo($hWndGUI)
        If @error Or $a[4] > 0 Then Return
        Local $win_pos = WinGetPos("Form1")
        If $win_pos[1] >= 0 Then
                For $i = $win_pos[1] To $win_pos[3] - 5 Step 10
                        WinMove("Form1", "", $win_pos[0], -$i, $win_pos[2], $win_pos[3])
                        Sleep(10)
                Next
        EndIf
          WinSetTrans($form1, "", 100)
EndFunc

 

Edited by guiltyking

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

not really, small button failed wm_ message and me..

it is so weird that when i add If @GUI_CtrlId=$idButton wm_ doesnot fail anymore..

Enjoy RayBAN Screen filter :)

#include <WindowsConstants.au3>
#include <winapiex.au3>;_WinAPI_TrackMouseEvent
;
Opt("GUIOnEventMode", 1)
;
HotKeySet("{ESC}", "_Custom_Exit")
;
Global $ParentWin_Width = @DesktopWidth,$ParentWin_Height = @DesktopHeight
Global $Top = 0, $ParentWin_Rght = 0, $ParentWin_Left = -1
Global $ParentWin_mn = 0,$nSteps = 20, $nBAR=5
Global $MOUSELEAVE = 0, $nBCKGRNDCLR=0x000000

$form1 = GUICreate('Form1', $ParentWin_Width, $ParentWin_Height, $ParentWin_Left, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $idButton=GUICtrlCreateButton("RayBAN", 140, 110,60,60)
        GUICtrlSetOnEvent($idButton, "Button")
    GUISetState()
    GUISetBkColor($nBCKGRNDCLR,$form1 )
GUIRegisterMsg(0x0200, '_WM_MOUSEMOVE')
GUIRegisterMsg(0x02A3, '_WM_MOUSELEAVE')
    ;
    Func _Custom_Exit()
        Exit    
    EndFunc
    ;
    While GUIGetMsg() <> -3
    WEnd

Func Button()
        If @GUI_CtrlId=$idButton Then
            If $nBCKGRNDCLR=0x000000 Then 
                $nBCKGRNDCLR=0xFFF000
                WinSetTrans($form1, "", 100)
            else  
                $nBCKGRNDCLR=0x000000
                WinSetTrans($form1, "", 255)
            EndIf
            GUISetBkColor($nBCKGRNDCLR,$form1 )
        EndIf
EndFunc

Func _WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)  ;==>_WM_MOUSEMOVE
          ;WinSetTrans($form1, "", 245)
        If $MOUSELEAVE Then  Return
        Local $win_pos = WinGetPos("Form1")
        For $i = $win_pos[1] To $win_pos[3] Step $nSteps
                If $i >= $nBAR Then ExitLoop
                WinMove("Form1", "", $win_pos[0], $i, $win_pos[2], $win_pos[3])
                Sleep(10)
        Next
        _WinAPI_TrackMouseEvent($form1, $TME_LEAVE)
        $MOUSELEAVE = 1
EndFunc 

Func _WM_MOUSELEAVE($hWndGUI, $MsgID, $wParam, $lParam) ;collapse
        $MOUSELEAVE = 0
        $a = GUIGetCursorInfo($hWndGUI)
        If @error Or $a[4] > 0 Then Return
        Local $win_pos = WinGetPos("Form1")
        If $win_pos[1] >= 0 Then
                For $i = $win_pos[1] To $win_pos[3] - $nBAR Step $nSteps
                        WinMove("Form1", "", $win_pos[0], -$i, $win_pos[2], $win_pos[3])
                        Sleep(10)
                Next
        EndIf
EndFunc

 

Edited by guiltyking

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