Sharing GDI handles between processes in Windows CE 6.0

白昼怎懂夜的黑 提交于 2019-12-02 07:48:21

I believe you are correct, you cannot rely on HFONTs being safe to pass across processes.

'The reason I ask, is that I've seen HFONTs passed to another application through PostMessage work correctly, but I didn't think they were 'supposed' to.'

They were not passed correctly, so there is no 'supposed to'. While HFONTs are not guaranteed to work across processes, they're also not guaranteed to be unique across processes. 'Arial' may have the same HFONT value in two difference processes at a point in time with a particular version of each application, and could change at any moment (including half-way through using it!)

It's like if I'm painting, and run out of orange paint, which i keep as the 3rd tube on my easle. I could reach for your easle and grab the 3rd tupe... but i have no guarantee that it's orange... i have no guarantee that it even contains paint! Perhaps you were brushing your teeth at the easle today.. oops!

GDI handles are like the number '3' in that example. Today, GDI might keep the tubed in the same order on all easles. It might keep some of them in order, some not (ie, orange 'sorta works', but 'seafoam green' is busted). They could be in order on one CE device, but not on another.

As always, YMMV.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!