program is started with params "-p <handle>"
I have no idea what it means, and how that answers my question (even if handle is passed to the program like this, it doesn't say what handle is passed)
I have also no idea what your screensaver does, nor what specific stuff is done by you or the OS in order to produce a screensaver preview. So please don't assume that I can understand what you say without detailed explanations.
It would be really great to see a complete and minimal app that reproduces the same problem, but without all the screensaver specific stuff -- if possible.