For many laptops the only way to enable functionality for those buttons is through a driver, even if sometimes these buttons work without drivers. The first thing to do is to install the necessary driver.
To download the driver use the HP (Compaq) Support website and type the model number of your laptop. You can find the model number on the back of the laptop on a sticker.
Download the driver from the INPUT category and restart the laptop. After this procedure, the buttons will work normally.