WinRT JScript 示例“远程桌面应用程序容器客户端示例”运行 RDP activeX 组件。此示例类似于从 Windows 应用商店下载的 RDP 应用程序。该示例包含在MSDN Windows-8-Modern-Style-App-Samples中。从代码中可以看出,JScript 在 WinRT 应用程序中执行 ActiveX !!!有谁知道如何将此示例适应 XAML ?
createClientControl: function (desktopWidth, desktopHeight) {
// Initialize RDP client control.
// Create object element.
var clientControlObject = document.createElement("object");
// Register for ActiveX events.
clientControlObject.addEventListener("readystatechange", function (e) {
if (clientControlObject.readyState !== 4) {
WinJS.log && WinJS.log("Error: ActiveX control readyState is not 4. ReadyState: " + clientControlObject.readyState, "sample", "error");
}
}, false);
clientControlObject.addEventListener("error", function (e) {
WinJS.log && WinJS.log("Error in loading the ActiveX control", "sample", "error");
}, false);
// Set object's classid to RDP client control's s CLSID.
clientControlObject.classid = "CLSID:EAB16C5D-EED1-4E95-868B-0FBA1B42C092";
clientControlObject.id = "clientControl";
// Set object's height and width.
clientControlObject.width = desktopWidth;
clientControlObject.height = desktopHeight;
// Add the element to DOM.
var clientControlRegion = document.getElementById("clientControlRegion");
clientControlRegion.appendChild(clientControlObject);
return clientControlObject;
},