Composed of a fluidic and an optical system, flow cytometry has been widely used for biosensing. The fluidic flow enables its automatic high-throughput sample loading and sorting while the optical system works for molecular detection by fluorescence for micron-level cells and particles. This technology is quite powerful and highly developed; however, it requires a sample in the form of a suspension and thus only works in vitro. In this study, we report a simple scheme to construct a flow cytometry based on a confocal microscope without any modifications. We demonstrate that line scanning of microscopy can effectively excite fluorescence of flowing microbeads or cells in a capillary tube in vitro and in blood vessels of live mice in vivo. This method can resolve microbeads at several microns and the results are comparable to a classic flow cytometer. The absolute diameter of flowing samples can be indicated directly. The sampling limitations and variations of this method is carefully analyzed. This scheme can be easily accomplished by any commercial confocal microscope systems, expands the function of them, and is of promising potential for simultaneous confocal microscopy and in vivo detection of cells in blood vessels of live animals by a single system.