I am looking to make a simple application that will capture the video from a Skype window every few milliseconds.
My questions are:
- How do I automatically locate the window handle? That is, which is the best strategy (by name or?) and how do I achieve that programatically?
- How I keep track of the window location as the user resizes it/moves it?
If skype is the active window you can use GetForegroundWindow. If not, using the process name is a good option. You can also combine them and see if you get the same window handle.
The following code will grab an image from a window handle and save it to disk as an image. If you call this code often and modify the code to create unique images you will get several images like you ask for. GetWindowRect is the key function to get the coordinates for the window. And ofcourse you can save the image in any format you like. The WPF functions for saving images are quicker than the winform code used here.