how to use backgroundworker thread call the API GetWindowRect?
can anybody give me a demo,tanks~!
[DllImport("user32.dll")]
private static extern int GetWindowRect(int hwnd, ref Rect lpRect);
private void bgw_DoWork(object sender, DoWorkEventArgs e)
{
while (bgw.WorkerSupportsCancellation)
{
GetWindowRect(hWnd,ref lpRect);
}
}
the question importance is not at define hWnd and lpRect,
i just give a demo.
the API GetWindowRect must based on GUI thread,but backgroundworker is another thread not based on GUI thread.
how can solve this quetion, can anybody compilation right.
even though i use System.Windows.Forms.Control.Invoke method,
but the method only have two overload,one is not have params,
another's params is object array.
how can i use ref params in object array?