たくさんのスクリーンショットを連続して作成するプログラムを作成しようとしています。スクリーンショットを何度も作り直すのではなく、画面間の変更のみを見つけたいのです。
これを行うために、画面レベルで GetUpdateRect() メソッドを使用しました。残念ながら、正しいデータが得られません。私はC#に比較的慣れていないので、何か間違ったことをしたと確信しています:P
このコードはすべての画面変更をログに記録する必要がありますが、代わりに [0,0,0,0] を返します。
[DllImport("User32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("User32.dll")]
public static extern bool GetUpdateRect(IntPtr hWnd, out Rectangle lpRect, bool bErase);
static void Main()
{
Rectangle updateRect;
GetUpdateRect(GetDesktopWindow(), out updateRect, false);
while (true)
{
Thread.Sleep(100);
Console.WriteLine(updateRect);
}
}
すべてのヘルプは大歓迎です! :D