• 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
https://www.neowin.net/forum/topic/1120878-c-c-help-to-catch-filename/
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]

  • 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]

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

    • No registered users viewing this page.
  • Posts

    • draw.io Desktop 30.2.6 by Razvan Serea draw.io desktop is a downloadable security-first diagramming application that runs on Windows, MacOS and Linux. Creating diagrams in the desktop app doesn’t need an internet connection. This is useful when you are disconnected or when you must create diagrams in a highly secure environment, where data protection is of the utmost importance. When you use the draw.io desktop app, your diagrams will be stored on your local device. Because this is a stand-alone application, also designed to run offline, there are no interfaces to cloud storage platforms available. Of course, you can still store your diagrams in folders that are synchronised to your cloud storage if you wish. Easy-to-use diagram editor The draw.io apps work just like the office and drawing tools you are used to using. Drag and drop shapes from the shape libraries and drag to draw connectors between them. Drag connectors to add waypoints and set a precise shape and position, or let them reroute automatically. Double click and start typing to add a label to anything. Create tables and swimlane flows with a familiar tool. Style shapes and connectors with customisable palettes, sketch options, fonts and text formatting tools. Search for shapes, including in open-source icon libraries. Use our vast libraries of shapes and templates, organised into logical categories, to create a range of diagrams and infographics. Generate diagrams from text descriptions using our smart templates. Diagram faster with keyboard shortcuts. draw.io Desktop 30.2.6 changelog: Uses electron 42.5.0 #2452 Updates to draw.io core 30.2.6. Download: draw.io 64-bit | Standalone (Open Source) Download: draw.io 32-bit | ARM64 | ARM64 Standalone Links: draw.io Home Page | Project page @GitHub | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      Excellence2025 earned a badge
      One Month Later
    • Week One Done
      Excellence2025 earned a badge
      Week One Done
    • Week One Done
      flexorcist earned a badge
      Week One Done
    • One Month Later
      Woland13 earned a badge
      One Month Later
    • Week One Done
      Woland13 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      500
    2. 2
      +Edouard
      216
    3. 3
      PsYcHoKiLLa
      147
    4. 4
      Steven P.
      74
    5. 5
      FloatingFatMan
      70
  • Tell a friend

    Love Neowin? Tell a friend!