  Since the first gravitational wave (GW) event from binary black hole (BBH)
was detected by LIGO-Virgo, GWs have become a useful probe on astrophysics and
cosmology. If compact dark matter (DM) objects e.g. primordial black holes,
contribute a significant fraction of dark matter at wide mass range, they will
cause microlensing in the GW signals with long wavelengths that are distinct
from the lensing effects of electromagnetic signals from astrophysical objects.
In this paper, we apply the lensing effect of GW from BBH to derive constraints
on the abundance of compact DM for the Cosmic Explorer, a third-generation
ground-based GW detector. We firstly consider two channels of formation of BBH
that contribute to low and high redshift GW sources, including the
astrophysical origin BBH scenario, and the primordial origin BBH scenario.
Secondly, comparing with the method of optical depth, we use the Bayesian
analysis to derive constraints on the abundance of compact DM with different
mass function of lens taken into consideration. For a null search with $1000$
detected GW events of BBH, we find that the abundance of compact DM could be
constrained to $\lesssim0.1\%$ in the mass range $\geq500~M_{\odot}$ at $68\%$
confidence level. In addition, if a GW event lensed by a compact DM object with
$M_{\rm l}\in[100~M_{\odot},300~M_{\odot}]$ is detected in $100$ detected GW
events of BBH, we can derive that the estimation of the abundance of compact DM
is from $2.3\%$ to $25.2\%$ in this mass range with the Bayesian analysis.
