Sharing GDI handles between processes in Windows CE 6.0

前端 未结 1 1424
清歌不尽
清歌不尽 2021-01-28 16:22

I know that GDI handles are unique and process specific in \'Big Windows\' but do they work the same way in Windows CE 6.0?

For example: I\'ve got a font management serv

1条回答
  •  礼貌的吻别
    2021-01-28 16:42

    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.

    0 讨论(0)
提交回复
热议问题