I am making a screen capturing application.
There’s answer on how to capture an active window, but I want to be able to capture a window under mouse even if it’s not active.
Do I understand correctly that I need to find handle of a window under mouse and then call Image.captureWindow(IntPtr handle)?
Use following function to get the cursor position in context of screen
Now you will have to use the EnumWindow function to enumerate all top level windows and then for each try this
when you get both the values positive for a window, thats the window on which your cursor is. Here is an example of how to capture a window from its handle
http://www.codeproject.com/Articles/19192/How-to-capture-a-Window-as-an-Image-and-save-it
Hope this helps you