[英].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.