capture window

I'm trying to make the list of windows that can capture and to get the capture image of the window in the list. I make sure to get window information and to capture in below code. But I don't know what window in the list is valid. For example, there is a part of the list in below table. No.1 has valid window. Others don't have window(can't capture).


How do I capture only window of application running by users?


=========================================================================

* Get Information about Application Window

CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID);


* Capture Application Window Image

CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowid, kCGWindowImageDefault);


e.g. Table

No.kCGWindowOwnerNamekCGWindowNamekCGWindowNumberkCGWindowLayerkCGWindowIsOnscreenkCGWindowOwnerPIDxywidthheight1Photos(null)1063001048752312007122Photos(null)1062001048001280223Photos(null)1061240104800128022