Detecting compact objects such as black holes, white dwarfs, strange (quark) stars and neutron stars by means of their gravitational lensing effect on an observed companion in a binary system has already been suggested almost four decades ago. However, these predictions were made even before the first observations of gravitational lensing, whereas nowadays gravitational microlensing surveys towards the Galactic bulge yield almost 1000 events per year where one star magnifies the light of a more distant one. With a specific view to those experiments, we therefore carry out simulations to assess the prospects for detection of the transient periodic magnification of the companion star, which lasts typically only a few hours in binaries involving a main-sequence star. We find that the effect is practically independent of the distance of the binary system from the observer, but a limit to its detectability is given by the achievability of dense monitoring with the required photometric accuracy. In sharp contrast to earlier expectations by other authors, we find that main-sequence stars are not substantially less favourable targets to observe this effect than white dwarfs, not only because of a better achievable photometry on the much brighter targets, but even more due to the fact that there are ≳104 times as many objects that can be monitored. The requirement of an almost edge-on orbit leads to a probability of the order of 3 × 10−4 for spotting the signature of an existing compact object in a binary system with this technique. Assuming an abundance of such systems of about 0.4 per cent, a high-cadence monitoring every 15 min with 5 per cent photometric accuracy would deliver a signal rate per target star of γ∼ 4 × 10−7 yr−1 at a recurrence period of about 6 months. With microlensing surveys having demonstrated the capability to monitor about 2 × 108 stars, one is therefore provided with the chance to detect roughly semi-annually recurring self-lensing signals from several compact objects in a binary system. These must not be mistaken for similar signatures that arise from isolated planetary mass objects that act as gravitational lens on a background star. If the photometric accuracy was pushed down to 0.3 per cent, 10 times as many signals would become detectable.