I did find a example for doing this using Theos Logos:
https://github.com/DHowett/theos-logos-examples/blob/master/logos.uiapplicationdelegate/Tweak.xm
But I'd like to know how to do it using CaptainHook.
Thank you!
So you want to use this function called MSHookMessageEx()
.