In principle you can, because the hardware buttons are connected to GPIO pins. You "only" have to find out or define how you communicate with the PC from the STM32.
Regards
/Peter
In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.