AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to generate a CLSID ?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ladiko



Joined: 13 Jul 2006
Posts: 290
Location: Berlin

PostPosted: Mon Aug 24, 2009 7:08 pm    Post subject: How to generate a CLSID ? Reply with quote

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
View user's profile Send private message
YMP



Joined: 23 Dec 2006
Posts: 418
Location: Russia

PostPosted: Tue Aug 25, 2009 3:08 am    Post subject: Reply with quote

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
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Tue Aug 25, 2009 4:42 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ladiko



Joined: 13 Jul 2006
Posts: 290
Location: Berlin

PostPosted: Tue Aug 25, 2009 7:28 am    Post subject: Reply with quote

thank you both, YMP and MasterFocus - this should help me Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group