The DH rule is pretty specific. To use a DH, the manger needs to submit a lineup containing 10 players. If the pitcher later bats, the DH is lost for the rest of the game. If the pitcher is listed as batting in the opening lineup, there's no DH that game. It's Rule 5.11 of MLB rules, which can be found here.