For macOS Cocoa, how do I specify a window or a rectangle on the screen for taking a screenshot?
问题 I have written a macOS app for measuring image files, and I wish to add a feature for capturing screenshots. I wish for it to have a user interface for doing it much like what the macOS app "Preview" has. To use its screenshot function, one does File > Take Screenshot, and one gets a submenu with these options: From Selection... From Window... From Entire Screen "From Selection..." lets you select a rectangle on the screen by clicking and dragging. "From Window..." lets you select an app