There's also cmd-shift-4 then hit spacebar, that'll turn into a "camera" cursor and highlight the foremost window. If you click the mouse button now, it'll take a shot of that window. If you move your cursor over another window, that window will highlight, click your mouse and take a screenshot...