Jump to content

Transparent GUI


 Share

Recommended Posts

Hello i found this GUI here on the forums and i try to use this GUIscript with anouther script but the buttons don't work :whistle:

Does anyone now why the buttons don't work please?

This is the originel GUI script

;
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------

#NoTrayIcon
#include <GUIConstants.au3>
opt("GUIOnEventMode", 1)

Dim $s_TempFile
$bmp = _TempFile()

FileInstall("gui.bmp", $bmp)

; Caption
$caption = "Program name..."
; Caption

$gui = GUICreate("Main GUI", 230, 110, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX, $WS_EX_LAYERED)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
$caption = GUICtrlCreateLabel($caption, 12, 4, 180, 14)
GUICtrlSetStyle($caption, -1, $WS_EX_TRANSPARENT); To show $caption text
GUICtrlSetStyle($caption, $DS_SETFOREGROUND)
GUICtrlSetFont($caption, 9, 400, -1, "Arial Bold")
GUICtrlSetColor($caption, 0xF5F5F5)
GUICtrlSetOnEvent($caption, "_Drag")
;GUICtrlSetBkColor($caption,0xFF00FF); To select $caption
$min = GUICtrlCreateLabel("", 198, 4, 11, 11)
GUICtrlSetOnEvent($min, "Minimize")
GUICtrlSetTip($min, "Minimize")
;GUICtrlSetStyle($min, -1, $WS_EX_TRANSPARENT); To select $min
;GUICtrlSetBkColor($min,0xFF00FF); To select $min
$close = GUICtrlCreateLabel("", 210, 4, 11, 11)
GUICtrlSetOnEvent($close, "Close")
GUICtrlSetTip($close, "Close")
;GUICtrlSetStyle($close, -1, $WS_EX_TRANSPARENT); To select $close
;GUICtrlSetBkColor($close,0xFF00FF); To select $close
$btn = GUICtrlCreateButton("Button", 90, 80, 50, 20)
GUICtrlSetStyle($btn, -1, $WS_EX_TRANSPARENT)
GUICtrlSetOnEvent($btn, "Btn")
$pic = GUICtrlCreatePic($bmp, 0, 0, 230, 110)
GUICtrlSetOnEvent($pic, "_Drag")
$contextmenu = GUICtrlCreateContextMenu($pic)
$min_item = GUICtrlCreateMenuItem("Min", $contextmenu)
GUICtrlSetOnEvent($min_item, "Minimize")
$close_item = GUICtrlCreateMenuItem("Close", $contextmenu)
GUICtrlSetOnEvent($close_item, "Close")
GUICtrlCreateMenuItem("", $contextmenu); separator
$about_item = GUICtrlCreateMenuItem("About", $contextmenu)
GUICtrlSetOnEvent($about_item, "About")

GUISetState(@SW_SHOW)

While 1
    Sleep(1000)
WEnd

Func Btn()
    GUISetState(@SW_HIDE)
    SplashTextOn("btn", "Button clicked", 130, 19, -1, -1, 1, "", 12)
    Sleep(100)
    SplashOff()
    GUISetState(@SW_SHOW)
EndFunc

Func About()
    GUISetState(@SW_HIDE)
    SplashTextOn("btn", "Button clicked", 130, 19, -1, -1, 1, "", 12)
    Sleep(100)
    SplashOff()
    GUISetState(@SW_SHOW)
EndFunc

Func Close()
    GUISetState(@SW_HIDE)
    FileDelete($bmp)
    Exit
EndFunc

Func Minimize()
    GUISetState(@SW_MINIMIZE)
EndFunc

Func _TempFile()
    Local $s_TempName
    
    Do
        $s_TempName = "~"
        While StringLen($s_TempName) < 7
            $s_TempName = $s_TempName & Chr(Round(Random(65, 90), 0))
        WEnd
        $s_TempName = @TempDir & "\" & $s_TempName & ".tmp"
    Until Not FileExists($s_TempName)
    Return ($s_TempName)
EndFunc

Func _Drag()
    DllCall("user32.dll", "int", "ReleaseCapture")
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc

And this is the code where i try to run the script with anouther script

#NoTrayIcon
#include <GUIConstants.au3>
opt("GUIOnEventMode", 1)

$oMyError = ObjEvent("AutoIt.Error","Quit")
$oMediaplayer = ObjCreate("WMPlayer.OCX.7") 

If Not IsObj($oMediaplayer) Then Exit
$oMediaplayer.Enabled = true
$oMediaplayer.WindowlessVideo= true
$oMediaPlayer.UImode="invisible"
$oMediaPlayControl=$oMediaPlayer.Controls
$oMediaPlaySettings=$oMediaPlayer.Settings  

Dim $s_TempFile
$bmp = _TempFile()

FileInstall("gui.bmp", $bmp)

$caption = "Online Radio Jukebox"

$gui = GUICreate("Online Radio Jukebox", 230, 110, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX, $WS_EX_LAYERED)
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
$caption = GUICtrlCreateLabel($caption, 12, 4, 180, 14)
GUICtrlSetStyle($caption, -1, $WS_EX_TRANSPARENT)
GUICtrlSetStyle($caption, $DS_SETFOREGROUND)
GUICtrlSetFont($caption, 9, 400, -1, "Arial Bold")
GUICtrlSetColor($caption, 0xff)
GUICtrlSetOnEvent($caption, "_Drag")
$min = GUICtrlCreateLabel("", 198, 4, 11, 11)
GUICtrlSetOnEvent($min, "Minimize")
GUICtrlSetTip($min, "Minimize")
$close = GUICtrlCreateLabel("", 210, 4, 11, 11)
GUICtrlSetOnEvent($close, "Close")
GUICtrlSetTip($close, "Close")
$pic = GUICtrlCreatePic($bmp, 0, 0, 230, 110)
GUICtrlSetOnEvent($pic, "_Drag")
$contextmenu = GUICtrlCreateContextMenu($pic)
$min_item = GUICtrlCreateMenuItem("Min", $contextmenu)
GUICtrlSetOnEvent($min_item, "Minimize")
$close_item = GUICtrlCreateMenuItem("Close", $contextmenu)
GUICtrlSetOnEvent($close_item, "Close")
GUICtrlCreateMenuItem("", $contextmenu); separator
$combo_name = GuiCtrlCreateCombo("", 10, 30, 155, 20)
GuiCtrlSetData($combo_name, "Real Rock 101.1|Studio Brussel|Donna|Q-Music|4Fm|Contact|C-Dance|TopRadio|SkyRadio|Tmf|Noordzee|Veronica|BNN-Fm|Be-One|Oradio")
$Volume = GuiCtrlCreateSlider( 13, 77, 148, 20)
GuiCtrlCreateLabel("Volume", 69, 58, 40, 20)
GUICtrlSetColor(-1, 0xff)
$VolLevel = $oMediaPlaySettings.Volume
GUICtrlSetData($Volume, $VolLevel)
$Play = GuiCtrlCreateButton("Play", 175, 30, 45, 22)
GUICtrlSetStyle($Play, -1, $WS_EX_TRANSPARENT)
GUICtrlSetOnEvent($Play, "Play")
$Stop = GuiCtrlCreateButton("Stop", 175, 55, 45, 22)
GUICtrlSetStyle($Stop, -1, $WS_EX_TRANSPARENT)
GUICtrlSetOnEvent($Stop, "Stop")
$Load = GUICtrlCreateButton("Load", 175, 80, 45, 22)
GUICtrlSetStyle($Load, -1, $WS_EX_TRANSPARENT)
GUICtrlSetOnEvent($Load, "Load")

GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $combo_name
        $Radio = GuiCtrlRead($combo_name)
        If $Radio = "Real Rock 101.1" Then
           $oMediaPlayer.URL="http://players.eonstreams.com/FastAim/Player/Play.php?PulseID=14908515&SecurityKey=5553"
        EndIf
        If $Radio = "Studio Brussel" Then
           $oMediaPlayer.URL="mms://streampower.belgacom.be/stubruhigh"
        EndIf
        If $Radio = "Donna" Then
           $oMediaPlayer.URL="mms://streampower.belgacom.be/donnahigh"
        EndIf
        If $Radio = "Q-Music" Then
           $oMediaPlayer.URL="http://www.q-music.be/asx/phpasx/qahi.asx"
        EndIf
        If $Radio = "4Fm" Then
           $oMediaPlayer.URL="mms://wm.streampower.be/4fm"
        EndIf
        If $Radio = "Contact" Then
           $oMediaPlayer.URL="mms://mediaserver02.cybernet.be/contactnl"
        EndIf
        If $Radio = "C-Dance" Then
           $oMediaPlayer.URL="http://www.c-dance.be/stream_high.asx"
        EndIf
        If $Radio = "TopRadio" Then
           $oMediaPlayer.URL="http://www.topradio.be/2005/topradio.asx"
        EndIf
        If $Radio = "SkyRadio" Then
           $oMediaPlayer.URL="http://cinecast.capcave.com/streams/SkyRadio/SkyRadio.asx"
        EndIf
        If $Radio = "Tmf" Then
           $oMediaPlayer.URL="http://stream.tmf.nl/asx/tmf_audio.asp"
        EndIf
        If $Radio = "Noordzee" Then
           $oMediaPlayer.URL="mms://hollywood.win2k.vuurwerk.nl/noordzee"
        EndIf
        If $Radio = "Veronica" Then
           $oMediaPlayer.URL="http://cinecast.capcave.com/streams/RadioVeronica/RadioVeronica.asx"
        EndIf
        If $Radio = "BNN-Fm" Then
           $oMediaPlayer.URL="http://wmplayer.bnn.fm"
        EndIf
        If $Radio = "Be-One" Then
           $oMediaPlayer.URL="http://www.beoneradio.be/modules/desktop/streaming/asx.aspx?sid=1"
        EndIf
        If $Radio = "Oradio" Then
           $oMediaPlayer.URL="http://www.oradio.be/stream/livestream.asx"
        EndIf
        
    Case Else
        If GUICtrlread($Volume) <> $VolLevel Then
            $oMediaPlaySettings.Volume = GUICtrlRead($Volume)
            $VolLevel = GUICtrlRead($Volume)
        EndIf
    EndSelect
WEnd

While 1
    Sleep(1000)
WEnd

Func Play()
    $oMediaPlayControl.Play
EndFunc

Func Stop()
    $oMediaPlayControl.Stop
EndFunc

Func Load()
    $media = FileOpenDialog("Offline Radio Jukebox", " {20D04FE0-3AEA-1069-A2D8-08002B30309D} ", "Media (*.wma;*.mp3)" ,1)
        $oMediaPlayer.URL = $media
EndFunc

Func Close()
    GUISetState(@SW_HIDE)
    FileDelete($bmp)
    Exit
EndFunc

Func Minimize()
    GUISetState(@SW_MINIMIZE)
EndFunc

Func _TempFile()
    Local $s_TempName
    
    Do
        $s_TempName = "~"
        While StringLen($s_TempName) < 7
            $s_TempName = $s_TempName & Chr(Round(Random(65, 90), 0))
        WEnd
        $s_TempName = @TempDir & "\" & $s_TempName & ".tmp"
    Until Not FileExists($s_TempName)
    Return ($s_TempName)
EndFunc

Func _Drag()
    DllCall("user32.dll", "int", "ReleaseCapture")
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $gui, "int", 0xA1, "int", 2, "int", 0)
EndFunc

Transparent_GUI.rar

Sapiente vince, rex, noli vincere ferro!

Link to comment
Share on other sites

Hi :whistle:

at first: you can not combine GUIGetMsg() and "GUIOnEventMode" !

Here is the modified script - much fun with studying and listening :dance:

Regards

Holger

<{POST_SNAPBACK}>

at first: you can not combine GUIGetMsg() and "GUIOnEventMode" ! :"> :">

Thanks for the help.

Do you know also if its possible if i delete #notrayicon

that i can minimize the radio to the tray?

Sapiente vince, rex, noli vincere ferro!

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...