More of a text snippet than a tutorial, this is how it's possible to call a function when the game loses focus.

In this example we have put the callback function in a custom APlayerController subclass, but it could be just about anywhere.

Also it might be worth wrapping this feature in a UUserGameSetting property so players can disable it if they don't want it.

void ABUIPlayerController::BeginPlay()
		.AddUObject( this, &ABUIPlayerController::OnWindowFocusChanged );

void ABUIPlayerController::OnWindowFocusChanged( bool bIsFocused )
// Don't pause in the editor, it's annoying
	if ( bIsFocused )
		// Unlimit game FPS
		GEngine->SetMaxFPS( 0 );

		// Unpause the game
		// MyHUD->SetPause( false );
		// Reduce FPS to max 10 while in the background
		GEngine->SetMaxFPS( 10.0f );

		// Pause the game, using your "show pause menu" function
		// MyHUD->SetPause( true );