tarh331_hax0r
12-05-2005, 06:46 AM
I wanted to use something like DOM's childNodes construction to retrieve all possible <PARAM> elements for an ActiveX control in Internet Explorer.
As an example, consider embedding a copy of Windows Media Player v9.x in a web page. The classid for WMP v9.x is "6BF52A52-394A-11d3-B153-00C04F79FAA6" so something like the following will serve as a basic template:
<html>
<body id="theBodyId">
<center>
<br>
<font size="3"><b>theWMP9Id</b></font><br>
<object id="theWMP9Id" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="300">
</object>
</center>
</body>
</html>
Now let's add two textareas to the page, and dump both the object's innerHTML and its childNodes:
<html>
<body id="theBodyId">
<center>
<br>
<font size="3"><b>theWMP9Id</b></font><br>
<object id="theWMP9Id" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="300">
</object>
<p>
<font size="3"><b>theWMP9Id.innerHTML</b></font><br>
<textarea id="theInnerHTMLTextArea" rows="10" cols="50"></textarea>
<p>
<font size="3"><b>theWMP9Id.childNodes</b></font><br>
<textarea id="theChildNodesTextArea" rows="10" cols="50"></textarea>
</center>
</body>
<script language="javascript">
theInnerHTMLTextArea.value = theWMP9Id.innerHTML;
theChildNodesString = "";
for(var i = 0; i < theWMP9Id.childNodes.length; i++)
{
theChildNodesString += "theWMP9Id.childNodes[" + i + "].name = " + theWMP9Id.childNodes[i].name + ".\n";
theChildNodesString += "theWMP9Id.childNodes[" + i + "].value = " + theWMP9Id.childNodes[i].value + ".\n";
theChildNodesString += "\n";
}
theChildNodesTextArea.value=theChildNodesString;
</script>
</html>
At this point we are showing 0 [zero] childNodes, but 19 different <PARAM> elements: [URL, rate, balance, currentPosition, defaultFrame, playCount, autoStart, currentMarker, invokeURLs, baseURL, volume, mute, uiMode, stretchToFit, windowlessVideo, enabled, enableContextMenu, fullScreen, SAMIStyle, SAMILang, SAMIFilename, captioningID, enableErrorDialogs, _cx, _cy].
Now really weird stuff happens if we start to declare PARAM's explicitly. For instance, let's declare, explicitly, the three PARAM's "URL", "autoStart", and "volume":
<html>
<body id="theBodyId">
<center>
<br>
<font size="3"><b>theWMP9Id</b></font><br>
<object id="theWMP9Id" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="300">
<PARAM NAME="URL" VALUE="http://audio-mp3.ibiblio.org:8000/wcpe.mp3">
<PARAM NAME="autoStart" VALUE="1">
<PARAM NAME="volume" VALUE="75">
</object>
<p>
<font size="3"><b>theWMP9Id.innerHTML</b></font><br>
<textarea id="theInnerHTMLTextArea" rows="10" cols="50"></textarea>
<p>
<font size="3"><b>theWMP9Id.childNodes</b></font><br>
<textarea id="theChildNodesTextArea" rows="10" cols="50"></textarea>
</center>
</body>
<script language="javascript">
theInnerHTMLTextArea.value = theWMP9Id.innerHTML;
theChildNodesString = "";
for(var i = 0; i < theWMP9Id.childNodes.length; i++)
{
theChildNodesString += "theWMP9Id.childNodes[" + i + "].name = \"" + theWMP9Id.childNodes[i].name + "\".\n";
theChildNodesString += "theWMP9Id.childNodes[" + i + "].value = \"" + theWMP9Id.childNodes[i].value + "\".\n";
theChildNodesString += "\n";
}
theChildNodesTextArea.value=theChildNodesString;
</script>
</html>
After running the code, we see that childNodes now reports the three PARAM's that we declared explicitly, but continues to ignore the remaining 16.
So childNodes gives us rather a biased view of the set of all possible PARAM's of an ActiveX control - namely, childNodes only tells us about those PARAM's that we had the foresight to define explicitly a priori.
Now in my search for a technique that would automate the gathering of PARAM's, I tried about a gazillion things in addition to "object.childNodes", among which were "object.attributes", "object.children", "object.all", "object.behaviorUrns", and probably a bunch of other stuff that I'm too tired to remember at this point.
Anyway, the bottom line is that I couldn't get anything to generate [programatically] a list of all possible PARAM's for an ActiveX control.
Instead, I had to dump the control's "innerHTML" into a textarea, and copy and paste its PARAM's back into my code.
So my question: Is there a way to do this programatically?
Alternatively, is there some reference at msdn.microsoft.com that gives a definitive list of all possible PARAM's for each ActiveX control?
Or is there some COM/DCOM viewer [that I could download] which would examine something like MSCOMCTL.OCX and tell me all the possible PARAM's for each ActiveX control?
Thanks!
As an example, consider embedding a copy of Windows Media Player v9.x in a web page. The classid for WMP v9.x is "6BF52A52-394A-11d3-B153-00C04F79FAA6" so something like the following will serve as a basic template:
<html>
<body id="theBodyId">
<center>
<br>
<font size="3"><b>theWMP9Id</b></font><br>
<object id="theWMP9Id" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="300">
</object>
</center>
</body>
</html>
Now let's add two textareas to the page, and dump both the object's innerHTML and its childNodes:
<html>
<body id="theBodyId">
<center>
<br>
<font size="3"><b>theWMP9Id</b></font><br>
<object id="theWMP9Id" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="300">
</object>
<p>
<font size="3"><b>theWMP9Id.innerHTML</b></font><br>
<textarea id="theInnerHTMLTextArea" rows="10" cols="50"></textarea>
<p>
<font size="3"><b>theWMP9Id.childNodes</b></font><br>
<textarea id="theChildNodesTextArea" rows="10" cols="50"></textarea>
</center>
</body>
<script language="javascript">
theInnerHTMLTextArea.value = theWMP9Id.innerHTML;
theChildNodesString = "";
for(var i = 0; i < theWMP9Id.childNodes.length; i++)
{
theChildNodesString += "theWMP9Id.childNodes[" + i + "].name = " + theWMP9Id.childNodes[i].name + ".\n";
theChildNodesString += "theWMP9Id.childNodes[" + i + "].value = " + theWMP9Id.childNodes[i].value + ".\n";
theChildNodesString += "\n";
}
theChildNodesTextArea.value=theChildNodesString;
</script>
</html>
At this point we are showing 0 [zero] childNodes, but 19 different <PARAM> elements: [URL, rate, balance, currentPosition, defaultFrame, playCount, autoStart, currentMarker, invokeURLs, baseURL, volume, mute, uiMode, stretchToFit, windowlessVideo, enabled, enableContextMenu, fullScreen, SAMIStyle, SAMILang, SAMIFilename, captioningID, enableErrorDialogs, _cx, _cy].
Now really weird stuff happens if we start to declare PARAM's explicitly. For instance, let's declare, explicitly, the three PARAM's "URL", "autoStart", and "volume":
<html>
<body id="theBodyId">
<center>
<br>
<font size="3"><b>theWMP9Id</b></font><br>
<object id="theWMP9Id" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="500" height="300">
<PARAM NAME="URL" VALUE="http://audio-mp3.ibiblio.org:8000/wcpe.mp3">
<PARAM NAME="autoStart" VALUE="1">
<PARAM NAME="volume" VALUE="75">
</object>
<p>
<font size="3"><b>theWMP9Id.innerHTML</b></font><br>
<textarea id="theInnerHTMLTextArea" rows="10" cols="50"></textarea>
<p>
<font size="3"><b>theWMP9Id.childNodes</b></font><br>
<textarea id="theChildNodesTextArea" rows="10" cols="50"></textarea>
</center>
</body>
<script language="javascript">
theInnerHTMLTextArea.value = theWMP9Id.innerHTML;
theChildNodesString = "";
for(var i = 0; i < theWMP9Id.childNodes.length; i++)
{
theChildNodesString += "theWMP9Id.childNodes[" + i + "].name = \"" + theWMP9Id.childNodes[i].name + "\".\n";
theChildNodesString += "theWMP9Id.childNodes[" + i + "].value = \"" + theWMP9Id.childNodes[i].value + "\".\n";
theChildNodesString += "\n";
}
theChildNodesTextArea.value=theChildNodesString;
</script>
</html>
After running the code, we see that childNodes now reports the three PARAM's that we declared explicitly, but continues to ignore the remaining 16.
So childNodes gives us rather a biased view of the set of all possible PARAM's of an ActiveX control - namely, childNodes only tells us about those PARAM's that we had the foresight to define explicitly a priori.
Now in my search for a technique that would automate the gathering of PARAM's, I tried about a gazillion things in addition to "object.childNodes", among which were "object.attributes", "object.children", "object.all", "object.behaviorUrns", and probably a bunch of other stuff that I'm too tired to remember at this point.
Anyway, the bottom line is that I couldn't get anything to generate [programatically] a list of all possible PARAM's for an ActiveX control.
Instead, I had to dump the control's "innerHTML" into a textarea, and copy and paste its PARAM's back into my code.
So my question: Is there a way to do this programatically?
Alternatively, is there some reference at msdn.microsoft.com that gives a definitive list of all possible PARAM's for each ActiveX control?
Or is there some COM/DCOM viewer [that I could download] which would examine something like MSCOMCTL.OCX and tell me all the possible PARAM's for each ActiveX control?
Thanks!