Quantum nondemolition measurements and ultrafast cooling of single spins are critical for scalable quantum computation. For such purposes, quantum evolution in a coupled structure of a nanodot, a microcavity, and a waveguide can be coherently controlled to establish efficient quantum pathways connecting in sequence an electron spin, a charged exciton, a cavity photon, and finally a flying photon in the waveguide. As an example of suppressing unwanted dynamics in complex solid-state systems, pulse shaping is employed to switch the nanodot-cavity coupling on demand and to perform robust quantum operation.