简体   繁体   English

此C ++代码的C#等效项

[英]C# equivalent of this C++ code

Is there any C# equivalent of the code below? 下面的代码是否有C#等效项?

 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);
    }

It seems that you want to embed a silverlight application into your own desktop application. 似乎您想将Silverlight应用程序嵌入到自己的桌面应用程序中。 I didn't do it myself, but it seems somewhat related to 我自己没有做,但是似乎与

Host silverlight in the Windows.Forms... 在Windows.Forms中托管silverlight ...

Also try googling for "embedding silverlight in winforms". 也可以尝试谷歌搜索“在winforms中嵌入Silverlight”。 One possibility would be to embed a web-browser control and load the silverlight app into it. 一种可能性是嵌入一个Web浏览器控件,并将Silverlight应用程序加载到其中。

PS: There is certainly no direct equivalent of your code since ATL is a C++-technology ... PS:由于ATL是一种C ++技术,因此肯定没有与您的代码直接等效的...

除了尝试使用P / Invoke制作行转录行的相当不正常的方法外,使用.net中的本机COM对象的预期方式是通过运行时可调用包装程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM