I wonder if you could help me solve my COM problem. I have a program that calls a COM method when the button is clicked. The code looks something like this:
private void Send_Click(object sender, EventArgs e)
{
p.Send(allChanges);
}
This code works fine. Bu开发者_Python百科t I have another program that calls the same COM method. the code looks like this:
private void Publish(List<Tuple<string, DataPair>> allChanges)
{
var d = new SendCallback(Send);
d.BeginInvoke(allChanges, null, null);
}
As you can see here I invoke the COM method using a delegate. If I don't use delegate, the program will crash due to COM exception.
The underlying Send function is the same.
Could anyone please advise? Thanks very much.
精彩评论