Question

I'm creating a utility program which draws some (user customizable) icons onto other windows on the desktop using a global hook. As bitmap objects are specific to a process, I'm creating separate HBITMAP objects for these icons in each process before I draw them, and all these handles are stored in a shared segment in the dll.

Now when an icon is removed in my program (by the user), all the HBITMAP objects for it in these different processes should be deleted. Can I do this using DeleteObject() in my main program or do I have to delete each handle in the process in which it was created?

Was it helpful?

Solution

Definitely you have to delete them from a process that created them - even if it works for you, for different windows version it might not.

OTHER TIPS

Handle to GDI Objects are normally private a process. You can check the return value of DeleteObject anyway.

I'm just guessing this one...
you should use a hook, to hook to a different window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top