We report on injection of optically created spin-polarized carriers into CdTe-based materials. The injected spins are initially aligned in a diluted magnetic semiconductor CdMnTe layer located on the top of CdMgTe layer in CdMnTe/CdMgTe spintronic generic model structures. A critical discussion of possible artifacts that may complicate the spin detection and its quantitative analysis is given. Although the spin injection efficiency, 80%, has been found by us to be basically independent of the thickness of the spin detecting layer, there is an essential difference between thin and wide detectors related to the strain-induced lifting of the valence band degeneracy in the former, when assessing the efficiency of the spin injection. Most importantly, we observe an effect of switching the spin injection process on and off by an external magnetic field variation within a relatively narrow field range. This effect can be achieved by a careful design of the interface between the diluted magnetic semiconductor and the non-magnetic semiconductor.