-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCreateGUID.ahk
39 lines (32 loc) · 1.37 KB
/
CreateGUID.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
; =============================================================================================================================================================
; Author ........: jNizM
; Released ......: 2021-10-13
; Modified ......: 2023-01-12
; Tested with....: AutoHotkey v2.0.2 (x64)
; Tested on .....: Windows 11 - 22H2 (x64)
; Function ......: CreateGUID()
;
; Parameter(s)...: No parameters used
;
; Return ........: Creates an Globally Unique IDentifier (GUID).
; A GUID provides a unique 128-bit integer used for CLSIDs and interface identifiers.
; =============================================================================================================================================================
#Requires AutoHotkey v2.0
CreateGUID()
{
static S_OK := 0, GUID := ""
pGUID := Buffer(16)
if (DllCall("ole32\CoCreateGuid", "Ptr", pGUID) = S_OK)
{
Size := VarSetStrCapacity(&GUID, 38)
if (DllCall("ole32\StringFromGUID2", "Ptr", pGUID, "Str", GUID, "Int", Size + 1))
{
return GUID
}
}
return
}
; =============================================================================================================================================================
; Example
; =============================================================================================================================================================
MsgBox CreateGUID()