Paste once then clear clipboard

I'm trying to make a program for password management for myself. I have everything working, but the only way I know how to move the password from the program to the browser or other application is by copying it over. Obviously, this has some security issues. I read somewhere that there is a way to control how content gets pasted such that when another program reads from the pasteboard, the program that wrote to the pasteboard sends the content directly rather than the content actually being on the pasteboard. If I do that, I could send the password to the first program requesting it and clear the pasteboard afterwards. The only problem is that I can't find references for doing this in C++. All I've found is how to copy to the pasteboard.

How can I make this work? Can I get the name of the program I'm copying to, so I can let the user know in case it goes to a malicious program?
Last edited on
Topic archived. No new replies allowed.