如何在 Windows Mobile 下生成 GUID?

发布于 2024-07-25 22:52:17 字数 363 浏览 1 评论 0原文

Windows Mobile 生态系统中是否有现成的 API (C / C++) 可用于生成 GUID? 我正在寻找简单的一次性 API 来执行此操作。 如果需要编写整个算法或使用一些额外的第三方模块,我将放弃这个。

背景。 为了向用户显示通知,我使用了 SHNotificationAdd,它需要一个 GUID。 MSDN 和其他来源中的示例表明 GUID 是硬编码的。 但是,我想将 SHNotification* 包装在一个类中,该类可以很好地融入我的应用程序的整体设计中。 MSDN 非常羞于透露有关 SHNOTIFICATIONDATA->clsid 代表什么的详细信息。 提到的“类”提出的问题多于它回答的问题。

Is there a ready-to-use API (C / C++) in Windows Mobile ecosystem that I could use to generate a GUID? I am looking for simple one-shot API to do this. If there is a need to write a whole algorithm or use some extra 3rd-party modules, I will do away without this.

Background. To display notification to the user I use SHNotificationAdd, which requires a GUID for it. Examples in MSDN and other sources show that GUID is hard-coded. However, I want to wrap the SHNotification* within a class that blends well within the overall design of my application. MSDN is very shy on details on what SHNOTIFICATIONDATA->clsid represents. The "class" mentioned raise more questions than it answers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雨落星ぅ辰 2024-08-01 22:52:17

对于 Windows Mobile,请使用 CoCreateGUID()...

Use CoCreateGUID() for Windows Mobile...

骑趴 2024-08-01 22:52:17

您不需要为 SHNOTIFICATIONDATA 生成 GUID。

仅当您希望 WM 通知实现 IshellNotificationCallback 接口的 COM 对象时,才设置 clsid。

引用自 MSDN

加载 SHNOTIFICATIONDATA 时
结构,您可以指定
通知类 (clsid)、窗口
接收命令选择(hwndSink),
或两者。 如果指定 clsid,
你的COM组件必须实现
IshellNotificationCallback。 如果你
指定 clsid 和 hwndSink,
COM 和 Window 消息样式
将生成回调。

我个人从未使用过COM回调,我总是使用Windows消息回调。 它的设置和使用更加容易,并且您不需要生成 GUID。

You don't need to generate a GUID for SHNOTIFICATIONDATA.

You only set the clsid if you want WM to notify a COM object that implements IshellNotificationCallback interface.

Quote from MSDN:

When loading up the SHNOTIFICATIONDATA
structure, you can specify either the
notification class (clsid), the window
to receive command choices (hwndSink),
or both. If you specify the clsid,
your COM component must implement
IshellNotificationCallback. If you
specify the clsid and an hwndSink,
both COM and Window Message-style
callbacks will be generated.

I've never personally used the COM callback, I always use the windows message callback. It's a lot easier to setup and use and you don't need to generate a GUID.

菊凝晚露 2024-08-01 22:52:17

您还可以使用 UuidCreate(CoCreateGuid 最终调用)。

You could also use UuidCreate (which CoCreateGuid eventually calls).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文