本文介绍了在Windows CE 6.0中共享进程之间的GDI句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道GDI句柄在大窗口中是独一无二的,但是它们在Windows CE 6.0中的工作方式是一样的吗?

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?

例如:
我有一个字体管理服务,其他几个服务和应用程序将使用。此服务具有有效字体和用于打印和显示的配置的列表; CreateFontIndirect()已被调用每个。当这些客户端应用程序之一请求特定字体(和配置)时,我可以返回适当的HFONT吗?如果没有,是否有一个安全/有效的方式来复制句柄,ala DuplicateHandle的内核句柄。

For example:I've got a font management service that several other services and applications will be using. This service has a list of valid fonts and configurations for printing and displaying; CreateFontIndirect() has been called on each of them. When one of these client applications requests a particular font (and configuration), can I return it the appropriate HFONT? If not, is there a safe/valid way to duplicate the handle, ala DuplicateHandle for Kernel handles.

我问的原因是,我已经看到通过PostMessage传递给另一个应用程序的HFONT正确工作,但我不认为他们是应该。 / p>

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.

推荐答案

我相信你是正确的,你不能依赖HFONTs安全跨越进程。

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

它们未正确传递,因此没有应该。虽然HFONT不能保证跨进程工作,但它们也不能保证在进程之间是独特的。 'Arial'在与每个应用程序的特定版本的时间点的两个差异过程中可以具有相同的HFONT值,并且可以在任何时刻改变(包括使用它的一半)。

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!)

这就像我画画,跑出橙色油漆,我把它作为第三根管子放在我的画架上。我可以达到你的easle和抓住第三个tupe ...但我不能保证它是橙色...我不能保证它甚至包含油漆!也许你今天正在刷牙你的牙齿.. oops!

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句柄就像数字'3'在那个例子。今天,GDI可能在所有的easles上保持相同的顺序。它可能保持一些他们的顺序,一些不(即,橙色的'排序作品',但'seafoam绿色被破坏)。它们可以在一个CE设备上,但不在另一个CE设备上。

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.

一如既往,YMMV。

这篇关于在Windows CE 6.0中共享进程之间的GDI句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 20:00