1) if your initial application to CIO is refused, your fees are returned.
2) If you withdraw your application during the 120 day period and request a refund, you will get a refund. It takes about 4 months.
3) If you submit your full application to the local CHC, but withdraw before it begins processing (status changes to "in process"), you can request a refund. No one can tell you how much time you have.
4) Once your application is in process, you cannot get a refund of the application/processing fee.
This info is in the application guide, on the CIC website, etc...