• 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

    • Lego Batman 2026 hahahaha. You thought I couldn't reply back???
    • The problem isn't with Epic, it's with the platform holders like Steam and Nintendo, they should be a lot more strict in their review process.
    • Hello, Installed here without issue. Regards, Aryeh Goretsky
    • Microsoft updates Visual Studio Code with easier language model discovery and in-app search by Paul Hill Microsoft has released Visual Studio Code 1.125, its latest weekly release. This week, the company has focused on discovering and installing extra language models via the Marketplace; searching the web and securely browsing over remote connections without leaving VS Code; choosing how long VS Code waits before installing extension updates; and delivering managed Copilot settings through existing device management tooling. In older versions of VS Code, extensions could contribute their own model providers, but to find these extensions, you needed the right tags to search for in the Extension view. Now, the Language Models editor gives you an Install Model Providers button that opens the Extensions view, which is filtered to extensions that contribute model providers, making it easier to find and install them. Once you install a provider, its model will appear in the model picker. If you use the integrated browser much, you can now look up information without leaving VS Code by typing a query into the integrated browser’s address bar. It will use your configured search engine, the same way a standalone browser does. You can use workbench.browser.searchEngine to pick a search engine. When the browser is opened in a remote workspace, it's now possible to proxy HTTP(S) traffic via the remote connection. This allows you to connect to any ports or services that can only be accessed from the remote machine. If you read our coverage from two weeks ago about VS Code 1.123, you might have seen that extension updates have a two-hour delay as a safety measure. In this update, Microsoft is giving you the ability to configure the time of the delay. You can find it under extensions.autoUpdateDelay. Finally, with this update, admins can deliver managed GitHub Copilot settings through native device management (MDM) channels on Windows and macOS, in addition to account-based enterprise settings files. Settings delivered via MDM appear as policy-enforced in VS Code and can’t be overridden locally. Future updates will extend the supported policy keys across Copilot surfaces. You can download the update from the Visual Studio Code website now.
  • Recent Achievements

    • Week One Done
      Classifyskilleducation earned a badge
      Week One Done
    • One Month Later
      eurospharma62 earned a badge
      One Month Later
    • Week One Done
      With What earned a badge
      Week One Done
    • Week One Done
      Harris Gilbert earned a badge
      Week One Done
    • One Month Later
      Vincian earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      543
    2. 2
      +Edouard
      171
    3. 3
      PsYcHoKiLLa
      82
    4. 4
      ATLien_0
      64
    5. 5
      neufuse
      64
  • Tell a friend

    Love Neowin? Tell a friend!