The DH must be selected prior to the game, and that selected hitter must come to bat at least one time -- unless the opposing team changes pitchers prior to that point. A team that chooses not to select a DH prior to a game is barred from using a DH for the rest of that game. A player who enters the game in place of the DH -- either as a pinch-hitter or a pinch-runner -- becomes the DH in his team's lineup thereafter.
If a player serving as the DH is later used on defense, he continues to bat in his same lineup spot. But for the rest of the game, his team cannot use a DH to bat in place of the pitcher. A team is also barred from using a DH for the rest of the game if the pitcher moves from the mound to another defensive position, a player pinch-hits for any other player and then becomes the pitcher, or the current pitcher pinch-hits or pinch-runs for the DH.