这是我写的一点代码,还请大家帮我看看
private SDK.fUpgradeCallBack fUpgradeCallBack;
private void button2_Click(object sender, EventArgs e)
{
t = new Thread(new ThreadStart(Threadp)); //实例化线程
t.Start();//启动线程
lUpgradeID = SDK.Upgrade(Form1.lLoginID, textBox1.Text, 0, fUpgradeCallBack, this.Handle);
}
public void Threadp()
{
//C#方必须申明一个变量,用来指向C++的回调指针函数,避免被C#回收掉。
fUpgradeCallBack = new XMSDK.fUpgradeCallBack(FUpgradeCallBackFun);
this.BeginInvoke(fUpgradeCallBack, "123"); // 异步调用委托,调用后立即返回并立即执行下面的语句
//...
}
结果报错
Application.Run(new Form1());//参数计数不匹配
private void FUpgradeCallBackFun(int lLoginID, int lUpgradechannel, int nTotalSize, int nSendSize, int dwUser)//升级回调
{
//处理dll传过来的数据
progressBar1.Minimum = 0;
progressBar1.Maximum = nTotalSize;
progressBar1.Value = nSendSize;
Thread.Sleep(200);
}
[此贴子已经被作者于2016-1-25 17:23编辑过]