• 0

C#, C++ help to catch filename


Question

I have couple of years of experience with C# and C++, making database programs and so on but I would need to make a simple DLL for use in Windows Media Center and I got no clue on how to do some things I would need. Sorry english is not my native language so i need to explain this the long way.

I would need to know what happens when I click play on Windows Media Center movie library (Blu-ray or MKV). When I click play WMC loads the DLL but the problem is how to make the DLL catch the information from WMC when clicked play, like the filename of the file.

For example Total Media Theatre has a WMC plugin, a registry key that tells WMC to load TMT WMC plugin DLL when trying to play BD and the DLL catches the filename and launches the file in TMT on top of WMC.

Here's all I could find about this, it has everything except no info about the DLL part, how to pass the filename to external player.

http://msdn.microsof...p/bb189523.aspx

With the samples above WMC opens the external player by sendiong it it command for example "C:\player.exe" the dll would need to send the command "C:\player.exe G:\" for example.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

On TMT it works like this. On registry, instead of directly to player they specify a .HTM file (along with the htm they have playerloader.dll):


<html>
<head>
<title>TotalMedia Theatre</title>
<script>
function GetArgument(ji)
{
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i = 0; i < gy.length; i++)
{
ft = gy[i].split("=");
if (ft[0] == ji) { return ft[1]; }
}
return null;
}
function GetPlayerCommandLine()
{
var path = null;
var filePath = null;
try
{
path = GetArgument("uri");
if (path == null) path = window.external.MediaCenter.MediaContext.GetProperty("Name");
}
catch (e) { path = window.location.search.substring(1); }

var i = path.indexOf("///");
if(i == -1) i = path.indexOf("//");
else i = i + 3;
filePath = path.substring(i);
if (path.indexOf("dvd") != -1 && filePath.length <= 3) {
var tempString;
if (filePath.charAt(2) == '/') tempString = filePath.substring(0, 2);
filePath = tempString + "\\";
}
return filePath;
}
function IsMCEEnabled()
{
return true;
}
function ReEnterDirectXExclusiveMode()
{
return false;
}
function OnLoad()
{
var dxExclusive = false;

try
{
window.external.MediaCenter.DirectXExclusive = false;
dxExclusive = window.external.MediaCenter.DirectXExclusive;
}
catch (e) { LaunchPlayer(); }
if (dxExclusive == true) setTimeout(OnLoad, 100);
else { LaunchPlayer(); }
}
function OnUnload()
{
try { PlayerLoader4.UnloadPlayer(); }
catch (e) { }
}
function GoBack()
{
PlayerLoader4.UnloadPlayer();
try { window.external.MediaCenter.CloseApplication(); }
catch (e) { }
}
function LaunchPlayer()
{
try
{
var comActiveX = new ActiveXObject("PlayerLoader4.PlayerLoader4Ctrl.32");
delete comActiveX;
document.body.innerHTML = '<object id="PlayerLoader4" width="100%" height="100%" classid="clsid:b1e62c80-95a6-49c1-8806-b43e6a4f3742"></object>';
}
catch (e)
{
document.body.innerHTML = '<object id="PlayerLoader4" width="100%" height="100%" classid="clsid:7ae2296c-ad65-4dbc-9413-96c5853418a7"></object>';
}
var filePath = GetPlayerCommandLine();
try { PlayerLoader4.GetCmdLine(GetPlayerCommandLine()); }
catch (e) { }
PlayerLoader4.LoadPlayer();
}

</script>
<style type="text/css">
* { margin: 0px; padding: 0px; }
</style>
</head>
<body bgcolor="#004080" onload="OnLoad();" onunload="OnUnload();" scroll="no">
</body>
</html>

[/CODE]

Link to comment
Share on other sites

  • 0

So I would need to do a wrapper exe that executes the player.exe so it will be launched with filepath. Maybe using the ExternalProcess but how to get the filepath from WMC?

Link to comment
Share on other sites

  • 0

How does this work? I think this starts something from the .dll file which then loads the player exe. b1e62c80-95a6-49c1-8806-b43e6a4f3742 below is the dll file, dunno what 7ae2296c-ad65-4dbc-9413-96c5853418a7 is as there was no occurences on the registry. I don't understand how this starts anything from the dll.


function LaunchPlayer()
{
try
{
var comActiveX = new ActiveXObject("PlayerLoader4.PlayerLoader4Ctrl.32");
delete comActiveX;
document.body.innerHTML = '<object id="PlayerLoader4" width="100%" height="100%" classid="clsid:b1e62c80-95a6-49c1-8806-b43e6a4f3742"></object>';
}
catch (e)
{
document.body.innerHTML = '<object id="PlayerLoader4" width="100%" height="100%" classid="clsid:7ae2296c-ad65-4dbc-9413-96c5853418a7"></object>';
}
var filePath = GetPlayerCommandLine();
try { PlayerLoader4.GetCmdLine(GetPlayerCommandLine()); }
catch (e) { }
PlayerLoader4.LoadPlayer();
}
[/CODE]

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.