Jump to content

Desktop-TV without Overlay Mixer


Kunda

Recommended Posts

I found a solution to provide Desktop-TV without having to use the old overlay mixer which is no longer supported in newer Windows versions.
It's basically a Autohotkey script which I compiled to an executable file DesktopTV-Win10.exe. Its currently only tested to work with Windows 10 and Windows 7 but may also work with other OS versions.

Features:

  • At the first start DesktopTV-Win10 creates an INI-file in which the settings are stored. It reads the current window position and dimensions from the DVBViewer settings.xml.
  • If the language setting in DVBViewer is not "Deutsch" the tray menu and settings window will be displayed in english otherwise in german.
  • At the first run DesktopTV-Win10 will start DVBViewer in fullscreen mode. If DVBViewer was already running it will be restarted to apply the necessary changes. The window is drawn as a child of the desktop so it will never be on top of another window. It's also "clickthrough-able" which means the context menu of the desktop will be shown when right-clicking the desktop. It's not possible to show desktop icons above the DVBViewer window. Therefore they must be temporarily hidden to avoid to unintentionally activate them. Your original setting for desktop items (Desktop context menu => display => show desktop icons) will be restored when DesktopTV-Win10 is closed.
  • DesktopTV-Win10 provides an icon in the system tray with some context menu options:
    • DVBViewer Forum: a direct link to this Forum thread
    • Exit DVBViewer: DVBViewer and DesktopTV-Win10 will be closed
    • Close DesktopTV-Win10: DVBViewer will be restarted in normal mode
    • Settings: opens the Settings window
  • In the settings window you can configure DesktopTV-Win10 by adjusting the following options:
    • Fullscreen: shows DVBViewer in fullscreen mode when activated. Otherwise the Window settings are used.
    • ClickThrough: the desktop context menu will be available when activated. Otherwise the DVBViewer context menu will be shown on right click.
    • Hide Desktop Icons: Choose if you want to show or hide the desktop icons. If both options Fullscreen and ClickThrough are activated desktop icons will always be hidden.
    • Window settings: these settings are used if the option Fullscreen was deactivated (all in Pixel):
      • horizontal Position
      • vertical Position
      • Width
      • Height

Remarks:

DesktopTV-Win10 makes the DVBViewer window a child of the desktop. If explorer.exe is closed/killed/restarted for any reason DVBViewer should therefore also be closed. Unfortunately this doesn't happen automatically so the application has to monitor explorer.exe and immediately close DVBViewer.exe if the PID of explorer.exe has changed. Otherwise DVBViewer.exe wouldn't work any longer and can't be closed in any way so you would have to restart your system to get it working again.This is the only reason why DesktopTV-Win10 has to run in the background as long as you're using the Desktop-TV mode.

 

Update to version 1.2:

  • The Ini-file is now saved in the configuration folder of DVBViewer to avoid write permission problems.
  • Reading the window dimension values from settings.xml is now more reliable. The values are always read from the section "Display". If the values W and H are not available the values CW and CH are used.
  • If UserMode=0 in usermode.ini the configuration folder is no longer considered to be in the installation folder of DVBViewer. You'll have to provide a full path with Root=[path] in usermode.ini in this case.
  • Closing DVBViewer from tray menu or when explorer.exe was closed didn't work if DVBViewer was configured to ask for confirmation on exit. I changed all occurences of the actions.ini argument -x6 to -x12326 (Close DVBViewer without confirmation) to make this working.
  • Some cosmetical changes for tray menu and settings dialog.

 

Update to version 1.3:

  • the exe file of Version 1.2 didn't work because a tray menu item couldn't be found when trying to apply an icon to it. The script worked because it doesn't apply icons to the tray menu items.

 

Tray menu
post-41379-0-57853500-1451029614_thumb.png

Settings
post-41379-0-70187900-1451029686_thumb.png

Autohotkey script DesktopTV-Win10.ahk

#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%
applicationname = DesktopTV
version = v1.2

;Pfad zu DVBViewer.exe aus der Registrierung lesen
;Read path to DVBViewer.exe from Registry
RegRead,DVBVPath,HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\DVBViewer.exe
SplitPath,DVBVPath,,InstallPath

;DVBViewer Einstellungen (Sprache und Fensterdaten) aus setup.xml lesen
;Read DVBViewer settings (Language and Window data) from setup.xml
IniRead,Mode,%InstallPath%\UserMode.ini,Mode,UserMode
IniRead,Root,%InstallPath%\UserMode.ini,Mode,Root
If Mode=1
DVBVSetup = %AppData%\%Root%
If Mode=2
DVBVSetup = %ProgramData%\%Root%
If Mode=0
DVBVSetup = %Root%
FileRead,Text,%DVBVSetup%\setup.xml
RegExMatch(Text,"<entry name=""Language"">(.+)</entry>",Lang)
Loop,Read,%DVBVSetup%\setup.xml
{
IfInString,A_LoopReadLine,<section name="Display">
{
Section = %A_Index%
Break
}
}
StringSplit, Text, Text, `n, `r
Loop, %Text0%
{
Line1 := Section + 1
Line2 := Section + 2
Line3 := Section + 3
Line4 := Section + 4
Line5 := Section + 5
Line6 := Section + 6
Line7 := Section + 7
Line8 := Section + 8
Line9 := Section + 9
Line10 := Section + 10
Line11 := Section + 11
Line12 := Section + 12
Line13 := Section + 13
Line14 := Section + 14
Line15 := Section + 15
Line16 := Section + 16
Line17 := Section + 17
Line18 := Section + 18
Line19 := Section + 19
Line20 := Section + 20
}
FileAppend,% Text%Line1% "`n" Text%Line2% "`n" Text%Line3% "`n" Text%Line4% "`n" Text%Line5% "`n" Text%Line6% "`n" Text%Line7% "`n" Text%Line8% "`n" Text%Line9% "`n" Text%Line10% "`n" Text%Line11% "`n" Text%Line12% "`n" Text%Line13% "`n" Text%Line14% "`n" Text%Line15% "`n" Text%Line16% "`n" Text%Line17% "`n" Text%Line18% "`n" Text%Line19% "`n" Text%Line20%,%temp%\Test.txt
FileRead, xmldata,%temp%\Test.txt
RegExMatch(xmldata,"<entry name=""X"">(.+)</entry>",Xdata)
RegExMatch(xmldata,"<entry name=""Y"">(.+)</entry>",Ydata)
RegExMatch(xmldata,"<entry name=""C?W"">(.+)</entry>",Wdata)
RegExMatch(xmldata,"<entry name=""C?H"">(.+)</entry>",Hdata)
FileDelete,%temp%\Test.txt

;Sprachoptionen
;Language options
If Lang1 = Deutsch
{
ExDVBV = DVBViewer &beenden
ExDTV = &Desktop TV beenden
Config = Einstellungen
Full = Vollbild
Click = Durchklickbar
Ico = Desktop-Icons verstecken
Hor = horizontale Fensterposition:
Vert = vertikale Fensterposition:
WW = Fensterbreite:
WH = Fensterhöhe:
Use = Anwenden
Quit = Abbrechen
Link = http://www.DVBViewer.tv/forum/topic/57471-desktop-tv-autohotkey-script-windows-10/?p=438929
}
Else
{
ExDVBV = &Exit DVBViewer
ExDTV = Close &Desktop TV
Config = Settings
Full = Fullscreen
Click = ClickThrough
Ico = Hide Desktop Icons
Hor = horizontal Position:
Vert = vertical Position:
WW = Width
WH = Height
Quit = Cancel
Use = Reload
Link = http://www.DVBViewer.tv/forum/topic/57519-desktop-tv-without-overlay-mixer/
}

Gosub,READINI
Gosub,TRAYMENU
OnExit, ExitSub

;ursprüngliche Einstellung für Desktop-Icons speichern
;Save current setting for desktop icons
ControlGet,HWND,Hwnd,,SysListView321,ahk_class Progman
If HWND =
ControlGet,HWND,Hwnd,,SysListView321,ahk_class WorkerW
If DllCall("IsWindowVisible",UInt,HWND)
ShowIcons = True

;Desktop-Icons verstecken, wenn die Option in den Einstellungen aktiviert wurde
;Hide desktop icons if this option is activated in settings
If HideDesktopIcons = True
WinHide,ahk_id %HWND%

;laufende DVBViewer-Instanz beenden, wenn vorhanden
;Exit currently running instance of DVBViewer if present
Process,Exist,DVBViewer.exe
If ErrorLevel <> 0
{
Run,%DVBVPath% -x12326
Process,WaitClose,DVBViewer.exe
}

;DVBViewer im Desktop-Modus starten
;Start DVBViewer in desktop mode
If (%FullScreen% = True AND %ClickThrough% = True)
WinHide,ahk_id %HWND%
Run,%DVBVPath%
WinWait,ahk_class TfrmMain
If ClickThrough = True
WinSet, Transparent, 255, ahk_class TfrmMain
WinSet,ExStyle,+0x80020, ahk_class TfrmMain
If FullScreen = True
Run,%DVBVPath% -x5
Else If FullScreen = False
WinMove,ahk_class TfrmMain,,%X%,%Y%,%Width%,%Height%
DllCall("SetParent",ptr,WinExist(),ptr,WinExist("Program Manager"))

;Wenn explorer.exe beendet wird DVBViewer ebenfalls beenden und Script neu starten
;If explorer.exe was closed also close DVBViewer and restart this script
Process,Exist,explorer.exe
PID = %errorlevel%
Loop
{
Sleep, 200
Process,Exist,explorer.exe
If errorlevel <> %PID%
{
Process,Close,DVBViewer.exe
Process,WaitClose,DVBViewer.exe
Process,Wait,explorer.exe
Run, C:\Tools\AeroGlass\SetWindowCompositionAttribute.exe class Shell_TrayWnd accent 2 2 0 0,, Hide
Run, C:\Tools\AeroGlass\SetWindowCompositionAttribute.exe class Shell_TrayWnd blur true,, Hide
Process,Exist,explorer.exe
PID = %errorlevel%
Reload
}

;Wenn DVBViewer beendet wird, dieses Script nach 3 Sekunden ebenfalls beenden
;If DVBViewer was closed also close this script after 3 seconds
Process,Exist,DVBViewer.exe
If ErrorLevel = 0
{
Sleep, 3000
ExitApp
}
}

READINI:
;INI-Datei erstellen
;Create INI file
IfNotExist,%DVBVSetup%\%applicationname%.ini
{
inifile=;%applicationname%.ini
inifile=%inifile%`n
inifile=%inifile%`n[settings]
inifile=%inifile%`nFullScreen=True
inifile=%inifile%`nClickThrough=True
inifile=%inifile%`nHideDesktopIcons=True
inifile=%inifile%`nX=%Xdata1%
inifile=%inifile%`nY=%Ydata1%
inifile=%inifile%`nWidth=%Wdata1%
inifile=%inifile%`nHeight=%Hdata1%
FileAppend,%inifile%,%DVBVSetup%\%applicationname%.ini
inifile=
}
IniRead,ClickThrough,%DVBVSetup%\%applicationname%.ini,Settings,ClickThrough
IniRead,HideDesktopIcons,%DVBVSetup%\%applicationname%.ini,Settings,HideDesktopIcons
IniRead,X,%DVBVSetup%\%applicationname%.ini,Settings,X
IniRead,Y,%DVBVSetup%\%applicationname%.ini,Settings,Y
IniRead,Width,%DVBVSetup%\%applicationname%.ini,Settings,Width
IniRead,Height,%DVBVSetup%\%applicationname%.ini,Settings,Height
IniRead,FullScreen,%DVBVSetup%\%applicationname%.ini,Settings,FullScreen
Return

TRAYMENU:
Menu,Tray,NoStandard
Menu,Tray,Tip,%applicationname% %version%
Menu,Tray,Add,%applicationname% %version%,FEEDBACK
Menu,Tray,Add
Menu,Tray,Add,DVBViewer &Forum,FEEDBACK
Menu,Tray,Add,%ExDVBV%,EXITDVBV
Menu,Tray,Add,%ExDTV%,EXITDTV
Menu,Tray,Add,&%Config%,SETTINGS
If A_IsCompiled = 1
{
Menu,Tray,Icon,%applicationname%,%A_ScriptName%
Menu,Tray,Icon,DVBViewer &Forum,%A_ScriptName%,-206
Menu,Tray,Icon,%ExDVBV%,%A_ScriptName%,-206
Menu,Tray,Icon,%ExDTV%,%A_ScriptName%,-207
Menu,Tray,Icon,&%Config%,%A_ScriptName%,-160
}
Return

FEEDBACK:
Run,%Link%
Return

SETTINGS:
Gui,99:Destroy
Gui,99:Margin,10,10
If A_IsCompiled = 1
Gui,99:Add,Picture,xm Icon1,%A_ScriptName%
Gui,99:Font,Bold
Gui,99:Add,Text,x+10 yp+10,%applicationname% %version%
If FullScreen=True
Gui,99:Add,Checkbox,xm y80 checked vFS,%Full%
Else If FullScreen=False
Gui,99:Add,Checkbox,xm vFS,%Full%
If ClickThrough=True
Gui,99: Add,Checkbox,xm checked vCT,%Click%
Else If ClickThrough=False
Gui,99: Add,Checkbox,xm vCT,%Click%
If HideDesktopIcons=True
Gui,99:Add,Checkbox,xm checked vHDI,%Ico%
Else If HideDesktopIcons=False
Gui,99:Add,Checkbox,xm vHDI,%Ico%
Gui,99:Font,Bold
Gui,99:Add,Text,xm y+20 Section,%Hor%
Gui,99:Add,Text,xm y+20,%Vert%
Gui,99:Add,Text,xm y+20,%WW%
Gui,99:Add,Text,xm y+20,%WH%
Gui,99:Add,Edit,ys w40 vnewX,%X%
Gui,99:Add,Edit,w40 vnewY,%Y%
Gui,99:Add,Edit,w40 vnewWidth,%Width%
Gui,99:Add,Edit,w40 vnewHeight ,%Height%
Gui,99:Add,Button,xm+30 Section Default gButtonOK,%Use%
Gui,99:Add,Button,ys gButtonCancel, %Quit%
Gui,99:+AlwaysOnTop
Gui,99:Show,,%Config%
Return

99GuiClose:
Gui,99:Destroy
Return

ButtonOK:
Gui,99:Submit
If FS=1
IniWrite,True,%DVBVSetup%\%applicationname%.ini,Settings,Fullscreen
Else If FS=0
IniWrite,False,%DVBVSetup%\%applicationname%.ini,Settings,Fullscreen
If CT=1
IniWrite,True,%DVBVSetup%\%applicationname%.ini,Settings,ClickThrough
Else If CT=0
IniWrite,False,%DVBVSetup%\%applicationname%.ini,Settings,ClickThrough
If HDI=1
IniWrite,True,%DVBVSetup%\%applicationname%.ini,Settings,HideDesktopIcons
Else If HDI=0
IniWrite,False,%DVBVSetup%\%applicationname%.ini,Settings,HideDesktopIcons
IniWrite,%newX%,%DVBVSetup%\%applicationname%.ini,Settings,X
IniWrite,%newY%,%DVBVSetup%\%applicationname%.ini,Settings,Y
IniWrite,%newWidth%,%DVBVSetup%\%applicationname%.ini,Settings,Width
IniWrite,%newHeight%,%DVBVSetup%\%applicationname%.ini,Settings,Height
Reload

ButtonCancel:
Gui,99:Destroy
Return

EXITDTV:
Run,%DVBVPath% -x12326
Process,WaitClose,DVBViewer.exe
Run,%DVBVPath%
ExitApp

EXITDVBV:
Run,%DVBVPath% -x12326
ExitApp

ExitSub:
If ShowIcons = True
WinShow,ahk_id %HWND%
ExitApp

 

post-41379-0-57853500-1451029614_thumb.png

post-41379-0-70187900-1451029686_thumb.png

DesktopTV-Win10_v1.3.zip

Edited by Kunda
  • Like 1
Link to comment
  • 2 weeks later...

Update to version 1.2.

For information about changes and download see first post.

 

Please provide feedback here if the application is working/not working for you. Especially interesting would be if someone could get it working on the currently untested Windows versions XP, Vista, Win8 and Win8.1.

 

Many thanks to Tjod who tested DesktopTV-Win10 and helped to fix some bugs.

Link to comment

Hi Residentcl,

it's just a simple manipulation of the DVBViewer main window. It makes it a child window of the desktop so it's always at the bottom of all other windows and it makes it "click-through-able" so you'll get the context menu of the desktop when you right click theDVBViewer window. All this can basically be done with a very small Autohotkey script (ahk_class TfrmMain is the handle of the DVBViewer window):

 

Desktopmode_Basics.ahk

Run, C:\Program Files (x86)\DVBViewer\DVBViewer.exe ;Start DVBViewer
WinWait, ahk_class TfrmMain ;Wait until the window is present
WinSet, Transparent, 255, ahk_class TfrmMain ;only needed for Win7 to get Click-Through working
WinSet, ExStyle, +0x80020, ahk_class TfrmMain ;make it Click-Through-able
DllCall("SetParent", ptr, WinExist() , ptr, WinExist("Program Manager")) ;make it a Desktop-Child

 

Everything else in the script is to avoid problems if explorer.exe was closed (see Remarks in first post) and to make it easy to use and configure for everyone without having to fiddle around with Autohotkey scripts.

The advantage in comparison with the old Desktop Mode feature of DVBViewer ist that it works without having to use the outdated Overlay Mixer renderer and that it's also working without fullscreen mode. You can pin the DVBViewer window on your desktop wherever you want and in every size you want. It will never come up on top of other windows.

Link to comment

Update to version 1.3:

- the exe file of Version 1.2 didn't work because a tray menu item couldn't be found when trying to apply an icon to it. The script worked because it doesn't apply icons to the tray menu items.

 

Please tell me if you try and it's not working for you.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...