Checking on additional info with this one...
So laptop states its not charging when its running and will run with no other problems off of its wall adapter power supply, but battery wont charge when its in operation, battery only charges when its off?
When off and charged to 100%, with running off the battery alone its able to power this laptop for at least an hour without the battery going dead on you after a full charge from power off charging?
If the battery once fully charged from being powered off and charged is able to hold the laptop live for at least an hour on its own without diving/draining fast, then I'd think that the power supply for the laptop might need to be replaced. However if the laptop running on battery when fully charged runs out of juice faster than when it was new, then I'd suggest a new battery. Its more probable for the battery itself to be pulling heavier with a weak cell. If this is the case then you might feel warmth from the battery when its being charged as the battery is fighting the taking of a charge. Some laptops have the ability to sense current input and if the external power supply isnt able to charge the battery + run the laptop, it will switch over to not charging the battery and as a last resort of staying alive it will run off of direct power from the power supply adapter which is the power supply that goes between outlet and the cord to the laptop. Interestingly on Lenovo Laptops they will even report that the power supply isnt the proper wattage for the laptop and act like yours plus the Core i5 2.4Ghz CPU will run in a non-turbo green power state affecting performance until a suitable heavier wattage power adapter/supply is used. Your is a Dell and not sure if Dell has such a current sensor to underclock a laptop and report wrong rated power supply.
By the way, is this power supply the one that came with laptop or a replacement that your using? If its a replacement then it might be the correct voltage but not able to carry the current demands of charging a battery + operation at the same time.
If this battery has never been replaced, it is probably a good idea to replace that first. Just saw that this is about a 10 year old laptop.
https://www.notebookcheck.net/Review-Dell-Latitude-E6400-Notebook.12875.0.html This link has all sorts of useful info on your laptop including battery life before drained figures of a healthy battery.