There are lots of topologies that can do this. See http://en.wikipedia.org/wiki/DC-to-DC_converter.
The simplest way I know of is to use a 555 timer to drive a mosfet to switch the dc on and off, then send the output to a transformer to step down the voltage, then rectify the other side.
Oops. I assumed that was a typo. Will be interested in discovering where a person finds 240 VDC. Depends quite a lot on how much current is involved. Might be inside an electronic device like a TV.
It's going to take a lot more than a 555 timer, MOSFET and transformer.
If you're planning on building it yourself, it's going to be a pretty involved project, and involve working with hazardous voltage potentials. You will need an oscilloscope for troubleshooting. If you are new to electronics, this is not a project you should attempt.
It would be easiest to look for an off-the-shelf solution; however you didn't mention what your current requirements at 12v are.
What you want to do. Is done in primary switched power supply. You will find a lot of ICs that can do this job. These kind of power supplies also require some transformers that may be more difficult to get. I am somewhat puzzled by your request. 240 volt DC. Is quite rare. That kind of DC voltage may be used in say electrical cars. And hence a warning. The site do not allow any automotive topics.