I did this many, years ago. I just ran through all the devices my remote had until one of them tripped the shutter. Range was pretty poor in my case, worse than one of the $2 ebay IR remotes, but your remote may do better.
Here's a user who had success with the code for a sony vcr (which I think is what I used):
https://www.pentaxforums.com/forums/6-pentax-dslr-discussion/90140-pentax-kx-...l-remotes.html
and another (also sony vcr):
https://www.pentaxforums.com/forums/22-pentax-camera-field-accessories/7128-r...tml#post140293