非同期じゃないとUIロックしちゃうじゃないですかーっ。(キャンセルボタンが押せない進捗ダイアログとかできてしまう)

>>647
ハンドルかぁ。
なんか以下の4種類ぐらい取得する方法あるっぽいけど違いがよくわからない・・・。

1:
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto, PreserveSig = true, SetLastError = false)]
private static extern IntPtr GetActiveWindow();

IntPtr hwnd = GetActiveWindow();

2:
[ComImport, Guid("EECDBF0E-BAE9-4CB6-A68E-9598E1CB57BB"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWindowNative
{
IntPtr WindowHandle { get; }
}

IntPtr hwnd = WindowHandle();

3:
IntPtr hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;

4:
IntPtr hwnd = WinRT.Interop.WindowNative.GetWindowHandle(Application.Current.MainWindow);