• 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

    • Bunch of w*nkers. . 
    • Autonomous post-training loop placed 8th of 4,000 and then rewrote its own evaluation strategy. An autonomous AI system built by researchers at Amazon's A-EVO-Lab completed a full post-training run on a 30 billion parameter NVIDIA Nemotron model — with no human in the loop, across four rounds running over multiple weeks — and then did something its designers had not planned for: it detected that its own internal evaluation metric had become misleading and redesigned the search strategy it was using to improve itself. https://www.techtimes.com/articles/319123/20260626/nvidia-ai-trained-itself-30b-model-corrected-its-own-broken-metric-mid-run.htm
    • Grok Adult Content Tops 10 Billion Images Monthly More than half of all traffic flowing through Grok, Elon Musk's flagship AI product, now comes from users requesting pornographic images, explicit videos, and **** roleplay https://www.techtimes.com/articles/319142/20260626/grok-adult-content-tops-10-billion-images-monthly-xai-engineers-admit-csam-has-no-fix.htm
    • If Ford would stop hiring SUITS to run the company, and put CAR GUYS back in charge perhaps they could do better. Heck, the only CAR they produce today is the Mustang. Hey Ford! Not everyone needs/wants an overpriced SUV or pickup truck that is so tall you have to have a step ladder to get in and out of it.
    • Amazing how some will just jump all over something. Probably the same people that thought Musk was a "tech god" before he saddled up with "bad orange man". Before, they worshiped at his feet, including a lot of so called hollywood types. Now, because he fell off the plantation truck, they toss him under the bus.
  • Recent Achievements

    • One Year In
      bernmeister earned a badge
      One Year In
    • Week One Done
      Scoobystu earned a badge
      Week One Done
    • Week One Done
      tuben earned a badge
      Week One Done
    • First Post
      OffsetAbs earned a badge
      First Post
    • Reacting Well
      OffsetAbs earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      499
    2. 2
      +Edouard
      229
    3. 3
      PsYcHoKiLLa
      163
    4. 4
      Steven P.
      76
    5. 5
      FloatingFatMan
      71
  • Tell a friend

    Love Neowin? Tell a friend!