C#相当于此C++;代码
下面的代码是否有C#等价物C#相当于此C++;代码,c#,visual-c++,activex,C#,Visual C++,Activex,下面的代码是否有C#等价物 HRESULT hr; ActiveXSite* pSite; pSite = CAxWindowlessHost<CMainDlg>::CreateControlSite(L"AgControl.AgControl", NULL, IDC_AGCONTROL1); if ( pSite != NULL ) { // disable right-click! pSite->SetAll
HRESULT hr;
ActiveXSite* pSite;
pSite = CAxWindowlessHost<CMainDlg>::CreateControlSite(L"AgControl.AgControl", NULL, IDC_AGCONTROL1);
if ( pSite != NULL )
{
// disable right-click!
pSite->SetAllowRClick(false);
// set moniker URL
CComBSTR bstrUrl("file:///C:/Temp/SilverlightDemo.xap");
pSite->SetUrl(bstrUrl);
PropertyParams props;
props.push_back( PropertyParam(L"Windowless", L"true") );
props.push_back( PropertyParam(L"MinRuntimeVersion", L"2.0.31005.0") );
props.push_back( PropertyParam(L"Source", static_cast<LPCWSTR>(bstrUrl)) );
props.push_back( PropertyParam(L"InitParams", L"") );
hr = pSite->ActivateAx(rc, false, props);
}
HRESULT-hr;
活性辉绿岩*辉绿岩;
pSite=CAxWindowlessHost::CreateControlSite(L“AgControl.AgControl”,NULL,IDC_AGCONTROL1);
如果(pSite!=NULL)
{
//禁用右键单击!
pSite->SetAllowRClick(假);
//设置名字对象URL
CCOMBSTRURL(“file:///C:/Temp/SilverlightDemo.xap");
pSite->SetUrl(bstrUrl);
房地产参数道具;
props.push_back(PropertyParam(L“Windowless”,L“true”);
props.push_back(PropertyParam(L“MinRuntimeVersion”,L“2.0.31005.0”);
道具。推回(属性参数(L“源”,静态施法(bstrUrl));
props.push_back(PropertyParam(L“InitParams”,L“”);
hr=pSite->ActivateAx(rc、false、props);
}
您似乎希望将silverlight应用程序嵌入到自己的桌面应用程序中。我不是自己做的,但这似乎有点关系
也可以尝试谷歌搜索“在winforms中嵌入silverlight”。一种可能是嵌入web浏览器控件并将silverlight应用程序加载到其中
PS:由于ATL是一种C++技术,因此肯定没有与您的代码直接等价的东西。除了尝试使用p/Invoke进行逐行转录这一非常反常的方法外,使用.net中本机COM对象的预期方法是通过刚刚添加的标记“activex”和“C”.>>t您似乎想将silverlight应用程序嵌入到您自己的桌面应用程序中。我尝试从winform中的COM组件托管AgControl,但由于某些原因,它无法工作。但Windows Media Player工作正常。奇怪。不想使用SL2 OOB和Web浏览器。我正在检查ISilverlightViewer、IXcpControlHost和IXcpControlHost2接口。我的C++知识是如此有限。(