Where to find CLSID, IID

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Where to find CLSID, IID

22 May 2024, 06:03

ILaunchSourceAppUserModelId::GetAppUserModelId
https://learn.microsoft.com/zh-cn/windows/win32/api/shobjidl_core/nf-shobjidl_core-ilaunchsourceappusermodelid-getappusermodelid

ComObj := ComObject(CLSID , IID)

Where should I find CLSID and IID?
Unable to search on Google
WKen
Posts: 200
Joined: 21 Feb 2023, 00:01

Re: Where to find CLSID, IID

22 May 2024, 07:13

CLSID
Additional CLSIDs may be found in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID.
User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: Where to find CLSID, IID

22 May 2024, 07:23

win32metadata
image.png
image.png (207.03 KiB) Viewed 753 times
teadrinker
Posts: 4411
Joined: 29 Mar 2015, 09:41
Contact:

Re: Where to find CLSID, IID

22 May 2024, 10:59

@gekunfei
https://www.magnumdb.com/
https://www.magnumdb.com/search?q=*LaunchSourceAppUserModelId
@thqby
I tried to install ILSpy, however:
2024.05.22-18.47.14.2.png
2024.05.22-18.47.14.2.png (89.6 KiB) Viewed 693 times
.NET 8.0 was also installed. What could be the problem?
Other constants are found, but sometimes in this form:
2024.05.22-19.01.56.8.png
2024.05.22-19.01.56.8.png (92.8 KiB) Viewed 692 times
User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: Where to find CLSID, IID

22 May 2024, 16:25

https://www.nuget.org/packages/Microsoft.Windows.SDK.Win32Metadata/

You need to download the metadata file and open it in ILSpy.
The guid is not defined in the metadata of your search.
image.png
image.png (94.95 KiB) Viewed 601 times
teadrinker
Posts: 4411
Joined: 29 Mar 2015, 09:41
Contact:

Re: Where to find CLSID, IID

22 May 2024, 18:27

Thanks, figured it out, it's all showing up now! :salute:
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Re: Where to find CLSID, IID

22 May 2024, 18:30

Thank you to all those who have provided assistance
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Re: Where to find CLSID, IID

24 May 2024, 02:12

@thqby @teadrinker
sid := "{2ce78010-74db-48bc-9c6a-10f372495723}"
iid := "{989191ac-28ff-4cf0-9584-e0d078bc2396}"
obj := ComObject(sid, iid)
error (0x80040154) 没有注册类

Windows.Win32.Foundation.Metadata.Guid(2559676844u, 10495, 19696, 149, 132, 224, 208, 120, 188, 35, 150)
ILaunchSourceAppUserModelId

Guid(753369104u, 29915, 18620, 156, 106, 16, 243, 114, 73, 87, 35)
SID_LaunchSourceAppUserModelId

How to convert this Guid into something that can be used in ahk?
teadrinker
Posts: 4411
Joined: 29 Mar 2015, 09:41
Contact:

Re: Where to find CLSID, IID

24 May 2024, 08:37

Code: Select all

#Requires AutoHotkey v2

str1 := 'Windows.Win32.Foundation.Metadata.Guid(2559676844u, 10495, 19696, 149, 132, 224, 208, 120, 188, 35, 150)'
str2 := 'Guid(753369104u, 29915, 18620, 156, 106, 16, 243, 114, 73, 87, 35)'
str3 := 'GUID ExampleGUID = {0x12345678, 0x1234, 0x5678, {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78}};'

MsgBox GuidByteArrayToCanonical(str1) . '`n'
     . GuidByteArrayToCanonical(str2) . '`n'
     . GuidByteArrayToCanonical(str3)

GuidByteArrayToCanonical(guidByteArray) {
    guidByteArray := StrReplace(guidByteArray, 'byte.MaxValue', '255')
    RegExMatch(guidByteArray, 'i)((?:0x)?[\da-f]+)u?' . RepeatStr(',\s?\{?((?1))', 10), &m)
    try {
        sGuid := Format("{{2:08X}-{:04X}-{:04X}-{:02X}{:02X}-" . RepeatStr('{:02X}', 6) . "}", m*)
        if !RegExMatch(sGuid, '([\dA-F]){8}(-(?1){4})(?2)(?2)-(?1){12}') {
            throw Error()
        }
        return "'" . sGuid . "'"
    } catch {
        MsgBox 'Could not find inline correct representation of GUID as a byte array'
    }
    RepeatStr(str, count) => StrReplace(Format('{:' . count . '}', ''), ' ', str)
}
Let me know if you encounter a GUID byte form that this function does not work with.
gekunfei wrote: error (0x80040154) 没有注册类
In this case, the problem is that you need the CLSID, not the SID.
Last edited by teadrinker on 24 May 2024, 08:43, edited 1 time in total.
User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: Where to find CLSID, IID

25 May 2024, 01:08

No more information about this interface was found. What do you want to do?
The calling method is as follows.

Code: Select all

serviceProvider := ComObjQuery( ??, IID_IServiceProvider)
ComCall(3, serviceProvider, 'ptr', SID_LaunchSourceAppUserModelId, 'ptr', IID_LaunchSourceAppUserModelId, 'ptr*', obj := ComValue(0xd, 0))
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Re: Where to find CLSID, IID

25 May 2024, 08:56

OK,I'll try it on Monday. There is no computer outside on weekends.
gekunfei
Posts: 12
Joined: 19 May 2024, 19:34
Contact:

Re: Where to find CLSID, IID

27 May 2024, 04:43

I can't find CLSID. Let me try another method to implement it

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: No registered users and 48 guests