Hi anupamk
Is your Compaq notebook OK now?
If not, and it is still under warranty, you'll probably want to get it in for repair right away, because any damage to the motherboard or other internal components can be expensive - but are usually covered by the warranty (with the exceptions of liquid spills & dropping the laptop).
Re: the noise
You mentioned the laptop was getting noisier. This may have been due to a fan that was failing. If it was the cpu fan - that's fairly serious, and could well explain why the system shutdown so quickly. If just a rear exhaust fan, that's not as bad, but needs fixing.
If the hard drive in your Compaq was the older metal ball-bearing type - it could be the bearings grinding [this sound is often referred to as a "whining"].
Re: battery
Not booting from the battery would most likely be 1) faulty battery 2) faulty connectors 3) faulty motherboard.
Re: ac power
Starting to boot, and then shutting off - sounds just like your top suspect - overheating.
Working inside a laptop is tricky business & requires that you pay attention to getting things apart & then back together again in the right order. If you do decide to take a look inside yourself (ie, if the laptop is out-of-warranty), here's a link to the Service Guide for your model
http://h10032.www1.hp.com/ctg/Manual/c00212209.pdf
It has all the diagrams & procedures you'll need. The hard part will be finding suitable replacement parts, should they be necessary. Generally, if the motherboard needs replacing, the most common response is to buy a new laptop (especially for value-market models), because there's no guarantee that replacing the motherboard will fix all the laptop's problems (should overheating have damaged the lcd screen - that's another expensive part). And motherboards are easy to damage when first learning how to repair them (you have to be careful about static shock to the components, etc.).
___________________
If you are lucky enough that the hardware is OK (if the cause of some overheating has been fixed, for example) - but the system still hangs while loading Windows - try booting into Safe Mode (start tapping the F8 key while the computer is powering on).
Best of luck
. . . Gary