Monday, April 25, 2011

Getting screenshot of Child Window

Hello Everyone,

If I have a handle to a window, how do I take a screenshot of any new child windows when they show up? Right now I have code that takes a screenshot every .1 seconds of a windows form. When I click on a drop down list box the subsequent screenshots do not include it. Using spy++ I can see that a new child window was created but not sure how to make sure it is included in my screenshots. Does anybody have any code that might include child windows?

Thanks in advance,

Bob

From stackoverflow
  • Yes, the dropdown of a ComboBox is a special window, a LISTBOX. .NET doesn't provide a built-in way to get the handle for it, you can P/Invoke SendMessage and send the CB_GETCOMBOBOXINFO message. COMBOBOXINFO.hwndList contains the handle.

    Note that there are other controls that behave that way, DateTimePicker for example. Also note that the window can extend beyond the bounds of your form.

    The code in this thread should be helpful to get the P/Invoke right.

  • No, it's not a "Listbox".

    Read MSDN and learn basic windows classes....

0 comments:

Post a Comment