AutoHotkey Community

It is currently May 26th, 2012, 8:38 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: August 24th, 2009, 8:08 pm 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 25th, 2009, 4:08 am 
Offline

Joined: December 23rd, 2006, 6:02 pm
Posts: 424
Location: Russia
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%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 25th, 2009, 5:42 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 25th, 2009, 8:28 am 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
thank you both, YMP and MasterFocus - this should help me :-)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, joetazz, Leef_me, Mickers, tidbit, tomoe_uehara, Yahoo [Bot] and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group