Although not related to your problem, I can tell you that Windows 8 is not supported on the Compaq Presario CQ40 family of laptops (HP have not released any Windows 8 drivers for the CQ40 models according to their website).
Only Windows Vista & Windows 7 is supported.
So even if you managed to install Windows 8, vital components like sound, graphics & network devices would not work properly, if at all.