There is an easer way.
You can just push lens release button and rotate the lens a bit but not detach it.
You need to focus on 10mm first, zoom to 24mm and do the above. Then zoom back to 10mm. Unfortunately focus will not be in the same position and focus ring won't work. So move camera further or close to find proper focus distance.
Of course, make sure you turn on Preview Exp in manual option, and set aperture to actual 4.0. UPD, also enable Shoot without lens option.
Note, you may damage your camera or lens as it's not recommended to detach the lens while camera is switched on.