Ignas Limanauskas
Ignas Limanauskas

Reputation: 2486

How do I generate GUID under Windows Mobile?

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.

Upvotes: 2

Views: 1337

Answers (3)

Igor Zevaka
Igor Zevaka

Reputation: 76500

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

Upvotes: 0

Shane Powell
Shane Powell

Reputation: 14148

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.

Upvotes: 1

i_am_jorf
i_am_jorf

Reputation: 54600

Use CoCreateGUID() for Windows Mobile...

Upvotes: 5

Related Questions