Examine the power socket carefully. Certain models of the Compaq laptop brands have had the socket break loose from the board. Very difficult and costly to fix unless you are good with a cold solder iron.
Also, feel all the way down the cable on the power adapter... feel for lumps or bulges... If the adapter has been stretched enough to break the wires a little bit... then any movement can cause the shut down.
New adapters for that model are as low as $11 on eBay.