 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ladiko
Joined: 13 Jul 2006 Posts: 290 Location: Berlin
|
Posted: Mon Aug 24, 2009 7:08 pm Post subject: How to generate a CLSID ? |
|
|
| Is there a simple way to generate a random "free" clsid? or if i generate a static clsid, how can i verify that is not used for something else by default? and yes i know, the likelihood of generating a already used clsid is near zero. |
|
| Back to top |
|
 |
YMP
Joined: 23 Dec 2006 Posts: 418 Location: Russia
|
Posted: Tue Aug 25, 2009 3:08 am Post subject: |
|
|
Not sure what you mean by "free" and "static". But here is what I could find.
| CoCreateGuid wrote: |
The CoCreateGuid function calls the RPC function UuidCreate, which creates a GUID, a globally unique 128-bit integer. Use the CoCreateGuid function when you need an absolutely unique number that you will use as a persistent identifier in a distributed environment.To a very high degree of certainty, this function returns a unique value – no other invocation, on the same or any other system (networked or not), should return the same value. |
| Code: |
VarSetCapacity(Guid, 16, 0) ; GUID structure itself.
VarSetCapacity(szGuid, 39, 0) ; Its string representation.
DllCall("ole32\CoCreateGuid", "uint", &Guid)
DllCall("ole32\StringFromCLSID", "uint", &Guid, "uint *", pOleStr)
DllCall("WideCharToMultiByte", "uint", 0, "int", 0, "uint", pOleStr
, "int", -1, "str", szGuid, "uint", 39
, "int", 0, "int", 0)
DllCall("ole32\CoTaskMemFree", "uint", pOleStr)
MsgBox, %szGuid%
|
|
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Tue Aug 25, 2009 4:42 am Post subject: |
|
|
I'd tell you to check this, but I wasn't quite sure if that's what you wanted. _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
ladiko
Joined: 13 Jul 2006 Posts: 290 Location: Berlin
|
Posted: Tue Aug 25, 2009 7:28 am Post subject: |
|
|
thank you both, YMP and MasterFocus - this should help me  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|