Take a look at OBS.
It's a Free and Open Source program that allows you to record both your screen and specific windows. (Note: it cannot record minimized windows, as minimized windows will stop rendering completely).
Here's a step-by-step on how to go about recording a specific window:
- Download and install OBS.
- Open OBS and the Program you want to record.
- In OBS, go to
Settings -> Settings
then go to Broadcast Settings
and set Mode
to File Output Only
.
- Set
File Path
to wherever you want the recording to be saved to.
- Click
OK
to save and apply the settings you just changed.
- In the main screen of OBS, right-click on the white box in the bottom left labeled
Scenes
, click Add Scene
, then enter any name you want to identify the scene as.
- Click on the scene name you just created in the same white box, then in the white box to the right labeled
Sources
, right-click and do Add -> Window Capture
and enter any name you want to identify the window capture as.
- In the
Window
dropdown, find your program window that you want to record and click it.
- Click
OK
to save that window to be recorded.
- Click
Preview Stream
and then click Edit Scene
and position the window in the recording box to however you want it displayed in the final recording.
- Click
Stop Preview
and you should be ready to record that window whenever you want.
- To start the recording, click
Start Recording
and to stop recording, click Stop Recording
.
This will record your program's window reguardless of whether it is in the foreground or background. Remember, since a window is not rendered when it is minimized, it will be unable to be recorded.