If you can boot-up into the BIOS, and the screen is good, then it is ''definitely a driver corruption issue''. Graphics drivers and printers are probably the most troublesome things for computers!
Uninstall with a graphics driver uninstall program such Display Driver Uninstaller:
https://www.wagnardsoft.com/
and follow instructions.
Then update the BIOS and other drivers from the HP website:
https://support.hp.com/nz-en/drivers/selfservice/Compaq-Presario-CQ42-Notebook-PC-series/4247493/model/4336974
That’s for the Compaq Presario CQ42-'''365TU''' Notebook PC. If yours is not the 365TU model then insert your specific model. The chipset driver is especially important.
If you get it working fine with Windows 7 then I’m guessing that Windows 10 would install with an inplace upgrade.
I’ve got Windows 10 running fine on a very old Dell laptop from 2008!
Let us know how it goes.
''P.S. Replacing your motherboard, if you could find one, would be too expensive for such an old computer.''