Sign in to follow this  
Followers 0
a440hz

Z-Order Help! [Solved]

9 posts in this topic

#1 ·  Posted (edited)

Hi all,

Since a picture is worth a thousand words, here's my interface ...

Posted Image

Here's the code to move the playlist and the mixer gui up and down behind the player and to move them all together when the player gui moves.

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

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

And the code to create the guis

; 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()

#Region ; Create PlayListTextGUI

Global $PlayListTxtGUI = GUICreate("Playlist Text", 380, 165, 44, 60, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $PlayListGuiHnd)
Global $PlayListTxtGuiHnd = WinGetHandle($PlayListTxtGUI)
GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, 380, 165)
GUICtrlSetState(-1, $GUI_DISABLE)
; just a text label
Global $lW = 376
$TBListView = GUICtrlCreateListView("",1,0,376,160)
$TBhnd = GUICtrlGetHandle($TBListView)
;GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateLabel("", 0, 0, 380, 20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT);
GUICtrlSetColor(-1, 0xFFFFFF)
_GUICtrlListView_SetExtendedListViewStyle($TBhnd, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_BORDERSELECT))
_GUICtrlListView_SetBkColor($TBhnd, $CLR_BLACK)
_GUICtrlListView_SetTextColor($TBhnd, $PlayListTextFG)
_GUICtrlListView_SetTextBkColor($TBhnd, $CLR_BLACK)
_GUICtrlListView_SetOutlineColor($TBhnd, $CLR_BLACK)
_GUICtrlListView_AddColumn($TBhnd, "#", 25)
_GUICtrlListView_AddColumn($TBhnd, "File Name", 200)
_GUICtrlListView_AddColumn($TBhnd, "Time", 60)
_GUICtrlListView_AddColumn($TBhnd, "Type", 40)
_GUICtrlListView_AddColumn($TBhnd, "Freq.", 50)
_GUICtrlListView_AddColumn($TBhnd, "Rate", 40)
_GUICtrlListView_AddColumn($TBhnd, "Ch.", 25)
_GUICtrlListView_AddColumn($TBhnd, "Path", 200)
GUISetState()
;_WinAPI_SetWindowPos($PlayListGuiHnd, $MixerGuiHnd, $PlayerGuiPos[0], $Y2, $MW, $MH, $SWP_NOACTIVATE)

#EndRegion ;Create PlayListTextGUI

;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()
GUISetState(@SW_SHOW,$PlayerGUIHnd)
GUISetState(@SW_SHOW,$PlayListGuiHnd)
GUISetState(@SW_SHOW,$PlayListTxtGuiHnd)
GUISetState(@SW_SHOW,$MixerGuiHnd)

The code, all of which I would never have come up with but for this great forum and the awesome people using it, works great to control the GUIs and they move without shifting their Z-order but when I click on either one to select items in the playlist or to move the sliders or click the buttons in the mixer, their windows move to the top of the order and obscure part of the player gui.

I want their order to ALWAYS be:

player,mixer,playlist

Can anyone help?

Thanks in advance,

Joe

Edited by a440hz

Are you experienced?

Share this post


Link to post
Share on other sites

a440hz,

Look at _WinAPI_SetWindowPos - it lets you change the z-order position of a window. As you can only set the window at the top or bottom of the list with this command, you would need to run it for all 3 GUIs each time to get them back in the correct order.

I have a nagging feeling that there is another way as well - I will have a search and see what I can find. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi M32,

I'm using it now (see previous code) but since each button and slider is a gui, maybe I'll need to add it to each of their move code as well. I've had problems with using using with anything other than a window handle. I may have to make the player the topmost window on the desktop and control the others using handles because using the following ends up wreaking havoc when I run other programs.

I was hoping I could specify Z-order by number somehow.

Thanks,

Joe

From AutoIt help:

#Include <WinAPI.au3>

_WinAPI_SetWindowPos($hWnd, $hAfter, $iX, $iY, $iCX, $iCY, $iFlags)

hAfter =

Identifies the window to precede the positioned window in the Z order. This parameter must be a

window handle or one of the following values:

$HWND_BOTTOM - Places the window at the bottom of the Z order

$HWND_NOTOPMOST - Places the window above all non-topmost windows

$HWND_TOP - Places the window at the top of the Z order

$HWND_TOPMOST - Places the window above all non-topmost windows

Slider move code and button code:

#Region ; Move Sliders

Func _FLSliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($FrontLeftButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($FrontLeftButtonGUIHandle,"",$npos[0], $Y2)
    Wend
EndFunc
Func _FRSliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($FrontRightButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($FrontRightButtonGUIHandle,"",$npos[0], $Y2)
    Wend
EndFunc
Func _CSliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($CenterButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($CenterButtonGUIHandle,"",$npos[0], $Y2)
    Wend
EndFunc
Func _LFESliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($LFEButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($LFEButtonGUIHandle,"",$npos[0], $Y2)
    Wend
EndFunc
Func _SLSliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($SurroundLeftButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($SurroundLeftButtonGUIHandle,"",$npos[0], $Y2)
    Wend
EndFunc
Func _SRSliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($SurroundRightButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($SurroundRightButtonGUIHandle,"",$npos[0], $Y2)
    Wend
EndFunc

Func _LMixChange()

    If $Lm < 4 Then
        $Lm += 1
    Else
        $Lm = 1
    EndIf
    SetBitMap($LMixerButtonGUI, $MixerButton[$Lm], 255)
    If $Lm = 2 Then _GetCurLevels()
    _ToggleMixButtons("L",$Lm)
EndFunc

Func _RMixChange()
    If $Rm < 4 Then
        $Rm += 1
    Else
        $Rm = 1
    EndIf
    SetBitMap($RMixerButtonGUI, $MixerButton[$Rm], 255)
    If $Rm = 2 Then _GetCurLevels()
    _ToggleMixButtons("R",$Rm)
EndFunc

Func _CMixChange()
    If $Cm < 4 Then
        $Cm += 1
    Else
        $Cm = 1
    EndIf
    SetBitMap($CMixerButtonGUI, $MixerButton[$Cm], 255)
    If $Cm = 2 Then _GetCurLevels()
    _ToggleMixButtons("C",$Cm)
EndFunc

Func _LFEMixChange()
    If $LFEm < 4 Then
        $LFEm += 1
    Else
        $LFEm = 1
    EndIf
    SetBitMap($LFEMixerButtonGUI, $MixerButton[$LFEm], 255)
    If $LFEm = 2 Then _GetCurLevels()
    _ToggleMixButtons("LFE",$LFEm)
EndFunc

Func _LsMixChange()
    If $Lsm < 4 Then
        $Lsm += 1
    Else
        $Lsm = 1
    EndIf
    SetBitMap($LsMixerButtonGUI, $MixerButton[$Lsm], 255)
    If $Lsm = 2 Then _GetCurLevels()
    _ToggleMixButtons("Ls",$Lsm)
    EndFunc

Func _RsMixChange()
    If $Rsm < 4 Then
        $Rsm += 1
    Else
        $Rsm = 1
    EndIf
    SetBitMap($RsMixerButtonGUI, $MixerButton[$Rsm], 255)
    If $Rsm = 2 Then _GetCurLevels()
    _ToggleMixButtons("Rs",$Rsm)
EndFunc

Func _ToggleMixButtons($Button,$tog)
$tLm = $Lm
$tRm = $Rm
$tCm = $Cm
$tLFEm = $LFEm
$tLsm = $Lsm
$tRsm = $Rsm
    Switch $Button

        Case "L"
            Switch $tog
                Case 1
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                Case 2
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,0)
                Case 3
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])

                Case 4
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,0)
            EndSwitch

        Case "R"
            Switch $tog
                Case 1
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                Case 2
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,0)
                Case 3
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])

                Case 4
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,0)
            EndSwitch

        Case "C"
            Switch $tog
                Case 1
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                Case 2
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,0)
                Case 3
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])

                Case 4
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,0)
            EndSwitch

        Case "LFE"
            Switch $tog
                Case 1
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                Case 2
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,0)
                Case 3
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])

                Case 4
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,0)
            EndSwitch

        Case "Ls"
            Switch $tog
                Case 1
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                Case 2
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,0)
                Case 3
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])

                Case 4
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,0)
            EndSwitch

        Case "Rs"
            Switch $tog
                Case 1
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])
                Case 2
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,0)
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,0)
                Case 3
                    _BASS_ChannelSetAttribute($Mixer1, $BASS_ATTRIB_VOL,$BassLevel[1])
                    _BASS_ChannelSetAttribute($Mixer2, $BASS_ATTRIB_VOL,$BassLevel[2])
                    _BASS_ChannelSetAttribute($Mixer3, $BASS_ATTRIB_VOL,$BassLevel[3])
                    _BASS_ChannelSetAttribute($Mixer4, $BASS_ATTRIB_VOL,$BassLevel[4])
                    _BASS_ChannelSetAttribute($Mixer5, $BASS_ATTRIB_VOL,$BassLevel[5])
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,$BassLevel[6])

                Case 4
                    _BASS_ChannelSetAttribute($Mixer6, $BASS_ATTRIB_VOL,0)
            EndSwitch



    EndSwitch
EndFunc

Func _GetCurLevels()
    $BassLevel[1] = _BASS_ChannelGetAttribute($Mixer1, $BASS_ATTRIB_VOL)
    $BassLevel[2] = _BASS_ChannelGetAttribute($Mixer2, $BASS_ATTRIB_VOL)
    $BassLevel[3] = _BASS_ChannelGetAttribute($Mixer3, $BASS_ATTRIB_VOL)
    $BassLevel[4] = _BASS_ChannelGetAttribute($Mixer4, $BASS_ATTRIB_VOL)
    $BassLevel[5] = _BASS_ChannelGetAttribute($Mixer5, $BASS_ATTRIB_VOL)
    $BassLevel[6] = _BASS_ChannelGetAttribute($Mixer6, $BASS_ATTRIB_VOL)
EndFunc

#EndRegion ; Toggle Mixer Buttons

Are you experienced?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This worked: :mellow:

Func _KeepOrder($X,$Y)
    $mpos = WinGetPos($MixerGuiHnd)
        _WinAPI_SetWindowPos($MixerGuiHnd, $PlayerGUIHnd, $X, $Y, $MW, $MH, $SWP_NOACTIVATE)
EndFunc

Func _FLSliderMove()
    While _IsPressed("01", $UserDll)
    $mpos = WinGetPos($MixerGuiHnd)
    $npos = WinGetPos($FrontLeftButtonGUIHandle)
    $cursor2 = _WinAPI_GetCursorInfo()
    $Y2 = $cursor2[4] -  ($VolSliderH/2)
    If $Y2 < $mpos[1] + $SliderTop Then $Y2 = $mpos[1] + $SliderTop
    If $Y2 > $mpos[1] + $SliderBottom Then $Y2 = $mpos[1] + $SliderBottom
    WinMove($FrontLeftButtonGUIHandle,"",$npos[0], $Y2)
    _KeepOrder($mpos[0],$mpos[1])
    Wend
EndFunc
Edited by a440hz

Are you experienced?

Share this post


Link to post
Share on other sites

Hi there, if you don't want to resize the window(ignore passed dimensions) you can add another parameter - Nomove and Noreposition

link

As well, if your windows have to be in a specific order...it might work to just set one as a child. See example.

#include <GUIConstantsEx.au3>
Global $gui
Example1()
    Do
        $msg = GUIGetMsg()
        sleep(100)
    Until $msg = $GUI_EVENT_CLOSE
    
; example 1
Func Example1()
    $gui=GUICreate("My GUI",200,200,-1,-1)
    $pic = GUICreate("", 140,100,-1,-1, -1, -1, $gui)
    GUISetState(@SW_SHOW,$gui)
    GUISetState(@SW_SHOW,$pic)
EndFunc   ;==>Example1

As an aside, I really hope you will share your finished product in the examples forum.....

Picea892

Share this post


Link to post
Share on other sites

Hi Picea892,

I think the function requires a width and height and since I won't be resizing anyway, I'm just feeding it static values and $SWP_NOACTIVATE. I have three main windows so I think I need to set some sort of Parent/Child relationship between all three and enforce it anytime one of the "GUI" controls changes position or reacts to clicks.

I'll have no problem sharing my code when I complete the project and will provide source for everything but the Stereo2Surround equation. That, my friend, I and another have been working on for many a year and countless hours and hope to see some kind of return other than the satisfaction that others will gain by hearing the music they are so familiar with in a way that they have never heard before!

Thank you for your contributions. Do you have a Surround Sound setup?

Regards,

Joe


Are you experienced?

Share this post


Link to post
Share on other sites

I'm glad I'm able to help. I understand about not sharing some pieces. No I don't have a surround sound setups, maybe one day when I have a spare dollar or two. Kids would just break it now anyways...have to wait until they grow up.

Good luck to you

Share this post


Link to post
Share on other sites

Well done for the interface! but i cant help you with Z order having issues with it myself :mellow:

Thanks. It was pretty challenging to create completely graphic based gui (except for the listview control) and use gui rollovers as well as sliders and buttons.

Here's an example of how to move three separate popup GUIs together and maintain zorder. The only problem I still have is if I bring up a new program window and overlap the GUIs, they all don't pop the the front on the first click, it takes two.

Regards,

Joe

#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <Constants.au3>
#include <WinAPI.au3>
Opt("GUIOnEventMode", 1)

Global $w = 200,$h =  $w, $x1 = $w, $y1 = $w
Global $offset = 25
Global $x2 = $x1 + $offset
Global $y2 = $y1 + $offset
Global $x3 = $x1 + ($offset * 2)
Global $y3 = $y1 + ($offset * 2)

Global $TopmostGUI = GUICreate("topmost", $w, $h, $x1, $y1, $WS_POPUP)
Global $TopmostGUIHnd = WinGetHandle($TopmostGUI)
GUISetBkColor(0x000000,$TopmostGUIHnd)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_MoveGUI")
GUISetOnEvent($GUI_EVENT_RESTORE,"_ZOrder")
GUIRegisterMsg($WM_MOVE, "WM_MOVE")
GUISetState()

Global $MiddleGUI = GUICreate("middle", $w, $h, $x2, $y2, $WS_POPUP,$WS_EX_TOOLWINDOW)
Global $MiddleGUIHnd = WinGetHandle($MiddleGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_ZOrder")
GUISetBkColor(0xFF0000,$MiddleGUIHnd)
GUISetState()

Global $BottomGUI = GUICreate("bottom", $w, $h, $x3, $y3, $WS_POPUP,$WS_EX_TOOLWINDOW)
Global $BottomGUIHnd = WinGetHandle($BottomGUI)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN,"_ZOrder")
GUISetBkColor(0xFFFF00,$BottomGUIHnd)
GUISetState()

_WinAPI_SetWindowPos($MiddleGUIHnd, $TopmostGUIHnd, $x2, $y2,$w, $h, $SWP_NOACTIVATE)
_WinAPI_SetWindowPos($BottomGUIHnd, $MiddleGUIHnd, $x3, $y3 ,$w, $h, $SWP_NOACTIVATE)

While 1
sleep(20)
Wend

Func WM_MOVE($hWnd, $iMsg, $iwParam, $ilParam)
    If ($hWnd = $TopmostGUIHnd) then
        $GuiPos = WinGetPos($TopmostGUIHnd)
        _WinAPI_SetWindowPos($MiddleGUI, $TopmostGUIHnd , $GuiPos[0] + $offset, $GuiPos[1] + $offset, $w, $h, $SWP_NOACTIVATE)
        _WinAPI_SetWindowPos($BottomGUI, $MiddleGUI, $GuiPos[0] + ($offset * 2), $GuiPos[1] + ($offset * 2), $w, $h, $SWP_NOACTIVATE)
    EndIf
EndFunc

Func _Zorder()
        $GuiPos = WinGetPos($TopmostGUIHnd)
        _WinAPI_SetWindowPos($MiddleGUI, $TopmostGUIHnd , $GuiPos[0] + $offset, $GuiPos[1] + $offset, $w, $h, $SWP_NOACTIVATE)
        _WinAPI_SetWindowPos($BottomGUI, $MiddleGUI, $GuiPos[0] + ($offset * 2), $GuiPos[1] + ($offset * 2), $w, $h, $SWP_NOACTIVATE)
EndFunc

Func _MoveGUI()
    dllcall("user32.dll","int","ReleaseCapture")
    dllcall("user32.dll","int","SendMessage","hWnd", $TopmostGUI,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
EndFunc

Are you experienced?

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  
Followers 0