简体   繁体   English

.NET为VS2003调用控件

[英].NET Invoke a control for VS2003

I am trying to use the Microsoft web browser control on a form, however if you navigate to a site that takes a long time to load; 我正在尝试在表单上使用Microsoft Web浏览器控件,但是,如果您导航到需要花费很长时间才能加载的网站,那么, the whole form UI locks up until everything is loaded. 整个表单UI都会锁定,直到所有内容加载完毕。 To combat this I am trying to run the web browser control seperate to everything else. 为了解决这个问题,我试图将Web浏览器控件与其他所有控件分开运行。 I have created a small sample app using this tutorial: http://msdn.microsoft.com/en-us/library/ms171728.aspx 我使用此教程创建了一个小示例应用程序: http : //msdn.microsoft.com/zh-cn/library/ms171728.aspx

I have an error on the below function: 我对以下功能有错误:

    void SetNavigate(String* text)
    {
        if(this->axWebBrowser1->InvokeRequired)
        {
            SetNavigateDelegate* d = __gc new SetNavigateDelegate(this, &Form1::SetNavigate);
            this->Invoke(d, __gc new Object[] { text });
        }
        else
        {
            this->axWebBrowser1->Navigate(text);
        }
    }

The line specifically is: 该行具体是:

this->Invoke(d, __gc new Object[] { text }); this-> Invoke(d,__gc new Object [] {text});

error C2958: the left parenthesis '(' found at '\\testbrowser\\form1.h(56)' was not matched correctly 错误C2958:在'\\ testbrowser \\ form1.h(56)'中找到的左括号'('不正确

I had to sub delegate for __delegate, __gc new for gcnew and ^ for * so I am guessing this is another 2003 .NET being behind the times problem, does any one know the correct syntax I am looking for to stop the error appearing? 我不得不为__delegate,为gcnew的__gc new和为*的^代理,所以我猜这是时代问题背后的另一个2003 .NET,有人知道我想要的正确语法以阻止错误出现吗?

In 2003, I don't think you could use the {} array initializers inline yet. 在2003年,我认为您还不能内联使用{}数组初始化器。 Try assigning the __gc new Object[] { text } to a named variable. 尝试将__gc new Object [] {text}分配给命名变量。

... and do anything you can to get away from writing managed c++ in vs2003. ...并尽一切可能摆脱在vs2003中编写托管c ++的麻烦。 It's completely awful, and C++/CLI introduced in 2005 is a big improvement. 这太糟糕了,2005年推出的C ++ / CLI是一个很大的改进。

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

相关问题 从VS2003到VS2005的转换问题? - Conversion Problem from VS2003 to VS2005? VS2003 C ++中不寻常的堆大小限制 - Unusual heap size limitations in VS2003 C++ 将C ++从VS2003迁移到VS2005需要哪些代码更改? - What code changes are required to migrate C++ from VS2003 to VS2005? 导入DLL的工作原理不同(VS2003至VS2010,多线程至多线程DLL) - Importing DLL's doesn't work the same (VS2003 to VS2010, multithreaded to multithreaded DLL) 从vs2003移植托管c ++到vs2008的问题 - Problem to porting managed c++ from vs2003 to vs2008 如何使用VS2003工具集在VS11中构建C ++项目? - How to build a C++ project from within VS11 using the VS2003 toolset? 使用MS VS2003计算前纪日期/时间的秒数 - calculate seconds-to-date for pre-epoch date/times using MS VS2003 即使添加了“ incl。incl。”,VS2003也找不到.h文件。 迪尔斯” - VS2003 can't find .h file even after addition to “additional incl. dirs” 在从 VS2003 迁移到 VS2010 时使用 _s 版本的函数,如 _tcssset 、 _tcscpy 等 - using _s versions of functions like _tcsset , _tcscpy etc while migrating from VS2003 to VS2010 端口项目VS2003-> VS2013错误C2039序列化不是hash_Map的成员 - Port project VS2003 -> VS2013 error C2039 serialize is not a member of hash_Map
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM