如何在 Windows Mobile 下生成 GUID?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 Windows Mobile,请使用 CoCreateGUID()...
Use CoCreateGUID() for Windows Mobile...
您不需要为 SHNOTIFICATIONDATA 生成 GUID。
仅当您希望 WM 通知实现 IshellNotificationCallback 接口的 COM 对象时,才设置 clsid。
引用自 MSDN:
我个人从未使用过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:
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.
您还可以使用 UuidCreate(CoCreateGuid 最终调用)。
You could also use UuidCreate (which CoCreateGuid eventually calls).