Jump to content

How to detect mouse click on Layered GUI


 Share

Recommended Posts

Hi,

This GUISetOnEvent is not registering a mouse click unless I hold down the button for a second. Does any kind soul have an alternative to react to the click more quickly? I would also appreciate any suggestions for programming the "if then" cursor checks more efficiently.

Thanks,

Joe

; Main GUI
Global $PlayerGUI = GUICreate("s2smain", $MW, $MH, $MX, $MY, BITOR($WS_POPUP,$WS_EX_TOPMOST),$WS_EX_LAYERED)
SetBitmap($PlayerGUI, $PlayerGUIImage, 255)
Global $PlayerGUIHnd = WinGetHandle($PlayerGUI)
GUISetIcon("as1trans.ico")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_CatchClick")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
GUISetState()

The _CatchClick function:

Func _CatchClick()
    If $CurPos[0] > $CloseL and $CurPos[0] < $CloseL + $TopButnW and $CurPos[1] > $CloseT and $CurPos[1] < $CloseT + $TopButnH Then
        _Close()
    ElseIf $CurPos[0] > $MinimizeL and $CurPos[0] < $MinimizeL + $TopButnW and $CurPos[1] > $MinimizeT and $CurPos[1] < $MinimizeT + $TopButnH Then
        _Minimize()
    ElseIf $CurPos[0] > $PlaylistL and $CurPos[0] < $PlaylistL + $TopButnW and $CurPos[1] > $PlaylistT and $CurPos[1] < $PlaylistT + $TopButnH Then
        _PlayList()
    ElseIf $CurPos[0] > $OptionsL and $CurPos[0] < $OptionsL + $TopButnW and $CurPos[1] > $OptionsT and $CurPos[1] < $OptionsT + $TopButnH Then
        _Options()
    ElseIf $CurPos[0] > $PlayL and $CurPos[0] < $PlayL + $TransButnW and $CurPos[1] > $PlayT and $CurPos[1] < $PlayT + $TransButnH Then
        _Play()
    ElseIf $CurPos[0] > $StopL and $CurPos[0] < $StopL + $TransButnW and $CurPos[1] > $StopT and $CurPos[1] < $StopT + $TransButnH Then
        _Stop()
    ElseIf $CurPos[0] > $PauseL and $CurPos[0] < $PauseL + $TransButnW and $CurPos[1] > $PauseT and $CurPos[1] < $PauseT + $TransButnH Then
        _Pause()
    ElseIf $CurPos[0] > $PrevL and $CurPos[0] < $PrevL + $TransButnW and $CurPos[1] > $PrevT and $CurPos[1] < $PrevT + $TransButnH Then
        _Prev()
    ElseIf $CurPos[0] > $NextL and $CurPos[0] < $NextL + $TransButnW and $CurPos[1] > $NextT and $CurPos[1] < $NextT + $TransButnH Then
        _Next()
    EndIf
EndFunc

What I'm doing in the While loop is this:

While 1
        _GetCursorPosition($PlayerGUIHnd)
    $PlayerGuiPos = WinGetPos($PlayerGUIHnd)
    $PlayListGuiPos = WinGetPos($PlayListGuiHnd)
    $MixerGuiPos = WinGetPos($MixerGuiHnd)
    $PlayListOffset = $PlayerGuiPos[1] - $PlayListGuiPos[1]
    $MixerGuiOffset = $MixerGuiPos[1] - $PlayerGuiPos[1]
WEnd[/autoitautoit]

And the only function I'm calling in the loop is this:

[code]Func _GetCursorPosition($handle)
    $CurPos = GUIGetCursorInfo($handle)

    ;Rollover Buttons
    If $CurPos[0] > $CloseL and $CurPos[0] < $CloseL + $TopButnW and $CurPos[1] > $CloseT and $CurPos[1] < $CloseT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $CloseButtonGUIImage, 255)
    ElseIf $CurPos[0] > $MinimizeL and $CurPos[0] < $MinimizeL + $TopButnW and $CurPos[1] > $MinimizeT and $CurPos[1] < $MinimizeT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $MinimizeButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PlaylistL and $CurPos[0] < $PlaylistL + $TopButnW and $CurPos[1] > $PlaylistT and $CurPos[1] < $PlaylistT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $PlaylistButtonGUIImage, 255)
    ElseIf $CurPos[0] > $OptionsL and $CurPos[0] < $OptionsL + $TopButnW and $CurPos[1] > $OptionsT and $CurPos[1] < $OptionsT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $OptionsButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PlayL and $CurPos[0] < $PlayL + $TransButnW and $CurPos[1] > $PlayT and $CurPos[1] < $PlayT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $PlayButtonGUIImage, 255)
    ElseIf $CurPos[0] > $StopL and $CurPos[0] < $StopL + $TransButnW and $CurPos[1] > $StopT and $CurPos[1] < $StopT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $StopButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PauseL and $CurPos[0] < $PauseL + $TransButnW and $CurPos[1] > $PauseT and $CurPos[1] < $PauseT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $PauseButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PrevL and $CurPos[0] < $PrevL + $TransButnW and $CurPos[1] > $PrevT and $CurPos[1] < $PrevT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $PrevButtonGUIImage, 255)
    ElseIf $CurPos[0] > $NextL and $CurPos[0] < $NextL + $TransButnW and $CurPos[1] > $NextT and $CurPos[1] < $NextT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $NextButtonGUIImage, 255)
    Else
        SetBitmap($PlayerGUIHnd, $PlayerGUIImage, 255)
    EndIf

EndFunc

Are you experienced?

Link to comment
Share on other sites

It would be better if you had one code instead a collection of pieces that don't work.

Regardless......You are missing a key function in Guigetcursorinfo. $curfPos[4] would be the control ID being hovered. So instead of querying to find if mouse is over the control, it is already given to you.

$curfPos[4] = ID of the control that the mouse cursor is hovering over (or 0 if none)

To ensure you don't undertake the mouseover twice. You will need to set a flag. Some people have problems with it, but I absolutely loveMr Creator's UDF

For your mouse problem...Maybe this will help?

Edited by picea892
Link to comment
Share on other sites

Thanks picea892! That should work for me even though this is a GUI with no controls on it, just graphics. I'm sorry, I should have posted all the code. Here a link to the other topic I posted with the whole code. Make sure to use the code in my last reply as I rewrote some of it because of new info. You'll also need the images included in the attached zip in same reply.

Joe

Are you experienced?

Link to comment
Share on other sites

Hi there

Very nice GUI

I've run into this problem before and solved it by not using Nisch. This should work for you. Also I didn't have the marquee include and so disabled it.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=playerGUI.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GDIPlus.au3>
;#include <Marquee.au3>
#include <Misc.au3>
#include <StaticConstants.au3>

Opt("GUIOnEventMode", 1)
Opt("MouseCoordMode", 0)
Opt("WinTitleMatchMode", 4)
Opt('MustDeclareVars', 0)

Global Const $AC_SRC_ALPHA = 1
Global Const $SC_DRAGMOVE = 0xF012
Global $UserDll = DllOpen("user32.dll")

_GDIPlus_Startup()
;Buttons & Sliders
Global $gFile, $handle, $CurPos
Global $Dw = @DesktopWidth
Global $Dh = @DesktopHeight
Global $Gw, $Gh, $Gx, $Gy
Global $Ow, $Oh, $Ox, $Oy
Global $MainGuiPos
Global $PlayListGuiPos
Global $MixerGuiPos
$gFile = @ScriptDir & "\images\S2SGUI.gif"
Global $PlayerGUIImage = _GDIPlus_ImageLoadFromFile($gFile)
Global $MW = _GDIPlus_ImageGetWidth($PlayerGUIImage)
Global $MH = _GDIPlus_ImageGetHeight($PlayerGUIImage)
Global $MX = ($Dw/2) - ($MW/2)
Global $MY = ($Dh/2) - ($MH/2)
Global $Ow = 440, $Oh = 350
Global $Ox = ($Dw/2) - ($Ow/2)
Global $Oy = ($Dh/2) - ($Oh/2)

Global $CloseT = 34
Global $CloseL = 379
Global $MinimizeT = 34
Global $MinimizeL = 348
Global $PlaylistT = 34
Global $PlaylistL = 60
Global $OptionsT = 34
Global $OptionsL = 91
Global $PlayT = 191
Global $PlayL = 220
Global $StopT = $PlayT
Global $StopL = 170
Global $PauseT = $PlayT
Global $PauseL = 270
Global $PrevT = $PlayT
Global $PrevL = 120
Global $NextT = $PlayT
Global $NextL = 320

Global $TopButnW = 28
Global $TopButnH = 30
Global $TransButnW = 24
Global $TransButnH = $TransButnW

$gFile = @ScriptDir & "\images\playlistgui.gif"
Global $PlayListGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
$gFile = @ScriptDir & "\images\mixergui.gif"
Global $MixerGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
; Sys Buttons
; Close
$gFile = @ScriptDir & "\images\close.gif"
Global $CloseButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
;Minimize
$gFile = @ScriptDir & "\images\minimize.gif"
Global $MinimizeButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
;Playlist
$gFile = @ScriptDir & "\images\playlist.gif"
Global $PlaylistButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
;Options
$gFile = @ScriptDir & "\images\options.gif"
Global $OptionsButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
;Transport Buttons
; Play
$gFile = @ScriptDir & "\images\play.gif"
Global $PlayButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
; Stop
Global $gFile = @ScriptDir & "\images\stop.gif"
Global $StopButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
; Pause
$gFile = @ScriptDir & "\images\pause.gif"
Global $PauseButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
; Prev
Global $gFile = @ScriptDir & "\images\prev.gif"
Global $PrevButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)
; Next
$gFile = @ScriptDir & "\images\next.gif"
Global $NextButtonGuiImage = _GDIPlus_ImageLoadFromFile($gFile)


Global $t; for/next counter
Global $i, $d, $v, $c
Global $X, $Y, $X2, $Y2 ;X Y Coordinate Holders
Global $ScrollingTextGUI, $ScrollingTextHnd
Global $TextBG = 0x000000
Global $text = "We all stay together wherever we go!!"
Global $sTextFG = 0xe4d701
Global $TextBGImage = @ScriptDir & "\images\20pxtextbox.gif"
Global $TextW = 349
Global $TextH = 20
Global $TextT = 0
Global $TextL = 0
Global $TextEdgeL = 59
Global $TextEdgeT = 155


; Main GUI
Global $PlayerGUI = GUICreate("s2smain", $MW, $MH, $MX, $MY, BITOR($WS_POPUP,$WS_EX_TOPMOST),$WS_EX_LAYERED)
SetBitmap($PlayerGUI, $PlayerGUIImage, 255)
Global $PlayerGUIHnd = WinGetHandle($PlayerGUI)
GUISetIcon("as1trans.ico")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_CatchClick")
;GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
GUISetState()

;PlaylistGui
Global $PlayListGUI = GUICreate("S2SPlaylist", $MW, $MH, $MX, $MY, $WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED))
SetBitmap($PlayListGUI, $PlayListGuiImage, 255)
Global $PlayListGuiHnd = WinGetHandle($PlayListGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_MovePlaylist",$PlayListGuiHnd)
GUISetState()

;MixerGui
Global $MixerGUI = GUICreate("S2SMixer", $MW, $MH, $MX, $MY,$WS_POPUP,BitOR($WS_EX_TOOLWINDOW,$WS_EX_LAYERED))
SetBitmap($MixerGUI, $MixerGuiImage, 255)
Global $MixerGuiHnd = WinGetHandle($MixerGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_MoveMixer",$MixerGuiHnd)
GUISetState()


_SetScrollText($text)


#Region ; Main Loop
While 1
    _GetCursorPosition($PlayerGUIHnd)
    $PlayerGuiPos = WinGetPos($PlayerGUIHnd)
    $PlayListGuiPos = WinGetPos($PlayListGuiHnd)
    $MixerGuiPos = WinGetPos($MixerGuiHnd)
    $PlayListOffset = $PlayerGuiPos[1] - $PlayListGuiPos[1]
    $MixerGuiOffset = $MixerGuiPos[1] - $PlayerGuiPos[1]
WEnd

Func _MovePlaylist()
    While _IsPressed("01", $UserDll)
        $PlayerGuiPos = WinGetPos($PlayerGUIHnd)
        $cursor = _WinAPI_GetCursorInfo()
        $Y2 = $cursor[4] - 20
        If $Y2 < $PlayerGuiPos[1] -170 Then $Y2 = $PlayerGuiPos[1] -170
        If $Y2 > $PlayerGuiPos[1] Then $Y2 = $PlayerGuiPos[1]
        _WinAPI_SetWindowPos($PlayListGuiHnd, $MixerGuiHnd, $PlayerGuiPos[0], $Y2, $MW, $MH, $SWP_NOACTIVATE)
    Wend
EndFunc

Func _MoveMixer()
    While _IsPressed("01", $UserDll)
        $PlayerGuiPos = WinGetPos($PlayerGUIHnd)
        $cursor = _WinAPI_GetCursorInfo()
        $Y2 = $cursor[4] -  220
        If $Y2 < $PlayerGuiPos[1]   Then $Y2 = $PlayerGuiPos[1]
        If $Y2 > $PlayerGuiPos[1] + 140 Then $Y2 = $PlayerGuiPos[1] + 140
        _WinAPI_SetWindowPos($MixerGuiHnd, $PlayerGUIHnd, $PlayerGuiPos[0], $Y2, $MW, $MH, $SWP_NOACTIVATE)
    Wend
EndFunc

Func _CatchClick()

    If $CurPos[0] > $CloseL and $CurPos[0] < $CloseL + $TopButnW and $CurPos[1] > $CloseT and $CurPos[1] < $CloseT + $TopButnH Then
        _Close()
        Return
    ElseIf $CurPos[0] > $MinimizeL and $CurPos[0] < $MinimizeL + $TopButnW and $CurPos[1] > $MinimizeT and $CurPos[1] < $MinimizeT + $TopButnH Then
        _Minimize()
        Return
    ElseIf $CurPos[0] > $PlaylistL and $CurPos[0] < $PlaylistL + $TopButnW and $CurPos[1] > $PlaylistT and $CurPos[1] < $PlaylistT + $TopButnH Then
        _PlayList()
        Return
    ElseIf $CurPos[0] > $OptionsL and $CurPos[0] < $OptionsL + $TopButnW and $CurPos[1] > $OptionsT and $CurPos[1] < $OptionsT + $TopButnH Then
        _Options()
        Return
    ElseIf $CurPos[0] > $PlayL and $CurPos[0] < $PlayL + $TransButnW and $CurPos[1] > $PlayT and $CurPos[1] < $PlayT + $TransButnH Then
        _Play()
        Return
    ElseIf $CurPos[0] > $StopL and $CurPos[0] < $StopL + $TransButnW and $CurPos[1] > $StopT and $CurPos[1] < $StopT + $TransButnH Then
        _Stop()
        Return
    ElseIf $CurPos[0] > $PauseL and $CurPos[0] < $PauseL + $TransButnW and $CurPos[1] > $PauseT and $CurPos[1] < $PauseT + $TransButnH Then
        _Pause()
        Return
    ElseIf $CurPos[0] > $PrevL and $CurPos[0] < $PrevL + $TransButnW and $CurPos[1] > $PrevT and $CurPos[1] < $PrevT + $TransButnH Then
        _Prev()
        Return
    ElseIf $CurPos[0] > $NextL and $CurPos[0] < $NextL + $TransButnW and $CurPos[1] > $NextT and $CurPos[1] < $NextT + $TransButnH Then
        _Next()
        Return
    EndIf
    If BitAND(WinGetState($PlayerGUI), 32) Then Return $GUI_RUNDEFMSG
    DllCall("user32.dll", "long", "SendMessage", "hwnd", $PlayerGUI, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
EndFunc

Func _GetCursorPosition($handle)
    $CurPos = GUIGetCursorInfo($handle)

    ;Rollover Close Button
    If $CurPos[0] > $CloseL and $CurPos[0] < $CloseL + $TopButnW and $CurPos[1] > $CloseT and $CurPos[1] < $CloseT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $CloseButtonGUIImage, 255)
    ElseIf $CurPos[0] > $MinimizeL and $CurPos[0] < $MinimizeL + $TopButnW and $CurPos[1] > $MinimizeT and $CurPos[1] < $MinimizeT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $MinimizeButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PlaylistL and $CurPos[0] < $PlaylistL + $TopButnW and $CurPos[1] > $PlaylistT and $CurPos[1] < $PlaylistT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $PlaylistButtonGUIImage, 255)
    ElseIf $CurPos[0] > $OptionsL and $CurPos[0] < $OptionsL + $TopButnW and $CurPos[1] > $OptionsT and $CurPos[1] < $OptionsT + $TopButnH Then
        SetBitmap($PlayerGUIHnd, $OptionsButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PlayL and $CurPos[0] < $PlayL + $TransButnW and $CurPos[1] > $PlayT and $CurPos[1] < $PlayT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $PlayButtonGUIImage, 255)
    ElseIf $CurPos[0] > $StopL and $CurPos[0] < $StopL + $TransButnW and $CurPos[1] > $StopT and $CurPos[1] < $StopT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $StopButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PauseL and $CurPos[0] < $PauseL + $TransButnW and $CurPos[1] > $PauseT and $CurPos[1] < $PauseT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $PauseButtonGUIImage, 255)
    ElseIf $CurPos[0] > $PrevL and $CurPos[0] < $PrevL + $TransButnW and $CurPos[1] > $PrevT and $CurPos[1] < $PrevT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $PrevButtonGUIImage, 255)
    ElseIf $CurPos[0] > $NextL and $CurPos[0] < $NextL + $TransButnW and $CurPos[1] > $NextT and $CurPos[1] < $NextT + $TransButnH Then
        SetBitmap($PlayerGUIHnd, $NextButtonGUIImage, 255)
    Else
        SetBitmap($PlayerGUIHnd, $PlayerGUIImage, 255)
    EndIf

EndFunc

Func _Close()
    GUIDelete($ScrollingTextHnd)
    GUIDelete($PlayerGUIHnd)
    GUIDelete($PlaylistGuiHnd)
    GUIDelete($MixerGuiHnd)
    _GDIPlus_ImageDispose($PlayerGUIImage)
    _GDIPlus_ImageDispose($CloseButtonGuiImage)
    _GDIPlus_ImageDispose($OptionsButtonGuiImage)
    _GDIPlus_ImageDispose($PlaylistButtonGuiImage)
    _GDIPlus_ImageDispose($MinimizeButtonGuiImage)
    _GDIPlus_ImageDispose($PlayButtonGuiImage)
    _GDIPlus_ImageDispose($StopButtonGuiImage)
    _GDIPlus_ImageDispose($PauseButtonGuiImage)
    _GDIPlus_ImageDispose($CloseButtonGuiImage)
    _GDIPlus_ImageDispose($NextButtonGuiImage)
    _GDIPlus_ImageDispose($PrevButtonGuiImage)

    _GDIPlus_Shutdown()
    Exit
EndFunc
Func _Play()
EndFunc
Func _Stop()
EndFunc
Func _Pause()
EndFunc
Func _Prev()
EndFunc
Func _Next()
EndFunc
Func _PLayList()
EndFunc
Func _Options()
EndFunc
Func _Minimize()
EndFunc
Func _CloseOptionsGUI()
EndFunc

; Create Scrolling Text GUI
Func _SetScrollText($text)
$ScrollingTextGUI = GUICreate("ScrollText", $TextW, $TextH, $TextEdgeL, $TextEdgeT, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $PlayerGUIHnd)
$ScrollingTextHnd = WinGetHandle($ScrollingTextGUI)
GUICtrlCreatePic($TextBGImage, 0, 0, $TextW, $TextH)
GUICtrlSetState(-1, $GUI_DISABLE)
;_GUICtrlMarquee_SetScroll(Default, Default, Default, 4,40)
;_GUICtrlMarquee_SetDisplay(Default, $sTextFG, $textBG, 12, "Verdana")
;_GUICtrlMarquee_Create($text, 0,  0, $TextW, $TextH)
GUISetState()
EndFunc

;==>SetBitmap
Func SetBitmap($hGUI, $hImage, $iOpacity)
    Local Const $ULW_ALPHA = 2
    Local Const $AC_SRC_ALPHA = 1
    Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
    $hScrDC = _WinAPI_GetDC(0)
    $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
    DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", $iOpacity)
    DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
    _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
    _WinAPI_ReleaseDC(0, $hScrDC)
    _WinAPI_SelectObject($hMemDC, $hOld)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteDC($hMemDC)
EndFunc

; Hnd the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image.
; ====================================================================================================

Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)

    If ($hWnd = $PlayerGUIHnd) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION

EndFunc   ;==>WM_NCHITTEST

Func WM_MOVE($hWnd, $iMsg, $iwParam, $ilParam)
    
    If ($hWnd = $PlayerGUIHnd) then
        $PlayerGuiPos = WinGetPos($PlayerGUIHnd)
        _WinAPI_SetWindowPos($MixerGuiHnd, $PlayerGUIHnd , $PlayerGuiPos[0], $PlayerGuiPos[1] + $MixerGuiOffset, $MW, $MH, $SWP_NOACTIVATE)
        _WinAPI_SetWindowPos($PlayListGuiHnd, $MixerGuiHnd, $PlayerGuiPos[0], $PlayerGuiPos[1] - $PlayListOffset, $MW, $MH, $SWP_NOACTIVATE)
    EndIf
EndFunc
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...