???????????????APM??
???????????? ???????[ 2013/4/3 9:49:50 ] ????????
????1??Control??? Invoke??BeginInvoke ?????????£?
????a??Invoke ?????????????ж?????????????????????????????????????з????????????Win32API??PostMessage ????С?
????b??BeginInvoke ????????????Win32API??PostMessage ?????
UnsafeNativeMethods.PostMessage(new HandleRef(this?? this.Handle)
?? threadCallbackMessage?? IntPtr.Zero?? IntPtr.Zero);
[DllImport("user32.dll"?? CharSet=CharSet.Auto)]
public static extern bool PostMessage(HandleRefhwnd?? intmsg?? IntPtrwparam?? IntPtrlparam);
????PostMessage ??windows api?????????????????????????????????С??????????????????÷???????????????????????????з???????н???????????????????????????????????????windows api???SendMessage()??
????2??InvokeRequired
??????????????????????????????????????????????????????£?
Int windowThreadProcessId = SafeNativeMethods.GetWindowThreadProcessId(ref2?? out num);
Int currentThreadId = SafeNativeMethods.GetCurrentThreadId();
return (windowThreadProcessId != currentThreadId);
??????????“???GetWindowThreadProcessId???????????????????????????????????????????????????Id???б??”??????
????3??????????????????
???????????????????? this.InvokeRequired ???????ж??????Invoke??BeginInvoke ?????????÷?????
private void InvokeControl(object mainThreadId)
{
if (this.InvokeRequired)
{
this.Invoke(new Action<String>(ChangeText)?? "InvokeRequired = true.?????Text?");
//this.textBox1.Invoke(new Action<int>(InvokeCount)?? (int)mainThreadId);
}
else
{
ChangeText("?????????????????????Text?");
}
}
private void ChangeText(String str)
{
this.textBox1.Text += str;
}
?????????InvokeControl????????? this.Invoke(Delegate del) ????? this.textBox1.Invoke(Delegate del) Ч??????????????????Invoke??BeginInvoke????????????? FindMarshalingControl() ?????????????????????????????????????????????????????????????????????? this.textBox1.Invoke(Delegate del) ???????? this.Invoke(Delegate del) ?????????????????????????????????????????????????????????????÷????????????????
????????????????????????????????????“?????????APM??”???????IAsyncResult???????????????????????????????????IAsyncResult?????????????????????????м???????????????????á?
??????
![](/images/ad-banner/ad-banner.png)
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11