This is post #14
https://www.excelfox.com/forum/showt...ll=1#post25008
https://www.excelfox.com/forum/showthread.php/2986-Version-Info-using-VBA-and-registry-quirks-InterRegional-Settings-GmbH?p=25008&viewfull=1#post25008
https://www.excelfox.com/forum/showt...age2#post25008
https://www.excelfox.com/forum/showthread.php/2986-Version-Info-using-VBA-and-registry-quirks-InterRegional-Settings-GmbH/page2#post25008
These notes are intended to bring together some "Clsid Clipboard" discussions from approximately here https://eileenslounge.com/viewtopic....288963#p288963 and here, https://eileenslounge.com/viewtopic....314925#p314925
( Just as a bit of time orientation as dates on posts don't mean much here, it would be the time period from about 1 – 4 years ago )
Clsid Late Binding
Talking vaguely , and not too accurately technically Speaking, about these sort of things:
Something to do with the sadly mostly deceased / killed off Internet Explorer
GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
MSForms.ListBox https://web.archive.org/web/20140610...emory-listbox/
CreateObject("New:{8BD21D20-EC42-11CE-9E0D-00AA006002F3}")
MSForms.DataObject https://web.archive.org/web/20140610...ms-dataobject/
CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
The last one is the most commonly used and known about, at least around the VBA area where I am, or have been, over the last few years
I was curious to look into those things, amongst other reasons to see if there were any others and/ or a way to figure out if there was any way to get at any others, as well as the usual excitements and arousals got from looking up skirts and things that I probably shouldn’t .
Some notes picked up from smarter people
Mike (SpeakEasy), Hans, Chris : From about here https://eileenslounge.com/viewtopic....288963#p288963
Microsoft simply hasn't exposed a class name for DataObject. Most object we use do have a class name. For those we can use early binding by setting a reference, or late binding by using GetObject/CreateObject with a class name. DataObject is an exception, so we MUST use its hexadecimal ClassID.
36-character strings: .. It's the formal string representation of the underlying 128bit UUID (which Microsoft tend to refer to as a GUID; a CLSID is just a GUID being used for a specific role - identifying a class object), that representation being 32 hexadecimal digits separated by 4 hyphens ...
We humans are sheltered from them normally, but there are odd occasions where we find we have to use them. Not very often for most users, it has to be said.
Mike (SpeakEasy), from about here https://eileenslounge.com/viewtopic....314925#p314925
GUID is just a unique identifier. Microsoft use unique identifiers for all sorts of purposes in Windows, and then they are given specific names to better indicate their purpose, hence FMTID in my previous post. The GUIDs you can use with CreateObject are actually knows as CLSIDs (or Class IDs); each and every class on Windows has it's own CLSID, and you can look them all up in the registry under HKEY_CLASSES_ROOT.
In general it offers little benefit compared to using the ProgID (the human readable string, such as word.application), and indeed often obfuscates what is going on (malware writers were big fans ...).
There are, however, a few rare scenarios where it can prove useful. Some COM objects do not have a ProgID. Often such objects are not directly useful to VB/VBA programmers, but some are. The one you use in your example, 1C3B4210-F441-11CE-B9EA-00AA006B1A69, is the userform clipboard object*, so we get a cheap way of simple clipboard access.
( * More accurately the userform dataobject, (Microsoft.Vbe.Interop.Forms.DataObjectClass - this is NOT a ProgID) which provides simple access to the clipboard )
Here is a macro I found a few years back:
Code:
' This workbook kept and updated here: (Folder at appBox.com excel fox2 excelfox2@gmail.com RegistryCmdListsWinGimics)
' https://powershell.one/wmi/root/cimv2/stdregprov-EnumKey ' https://www.vbforums.com/showthread.php?552899-Getting-all-sub-keys-from-a-registry-value https://www.vba-tutorial.de/apireferenz/registry.htm
Sub ListCLSIDs() ' http://www.eileenslounge.com/viewtopic.php?f=26&t=22603&p=289007#p289007
Dim Ws As Worksheet: Set Ws = Me ' Set Ws = ActiveSheet
Dim Registry As Object, varKey As Variant, varKeys As Variant
Set Registry = GetObject("winmgmts:\\.\root\default:StdRegProv")
Registry.EnumKey 2147483650#, "SOFTWARE\Classes\CLSID", varKeys ' https://powershell.one/wmi/root/cimv2/stdregprov-EnumKey
Dim Cnt As Long: Let Cnt = 1
For Each varKey In varKeys
' Let Ws.Range("A" & Ws.Range("A" & Ws.Rows.Count & "").End(xlUp).Row + 1 & "").Value = varKey
Let Cnt = Cnt + 1
Let Ws.Range("A" & Cnt & "").Value = varKey
Next
End Sub
Here is a more recent one from Mike ( Speakeasy https://eileenslounge.com/viewtopic....314941#p314941 )
Code:
Public Const HKEY_CLASSES_ROOT = &H80000000 ' https://eileenslounge.com/viewtopic.php?p=314945#p314945
Public Sub GetCLSIDs_and_ProgIDs() ' https://eileenslounge.com/viewtopic.php?p=314941#p314941
Dim entryArray() As Variant
Dim KeyValue As Variant ' Dim KeyValue As String ..... Automation-errors-The-called-object-has-been-disconnected-from-the-clients - https://eileenslounge.com/viewtopic.php?p=314950#p314950 Mike: The error is somewhat misleading. It is down to the fact that the XP (and presumably Vista and W7, although I can't test them) WMI provider (which gives us the Registry access) handles returning Null differently than the one on W10 https://eileenslounge.com/viewtopic.php?p=314953#p314953
Dim KeyPath As String
Dim x As Long
Dim row As Long
Dim RegistryObject As Object
Dim strComputer As String
strComputer = "."
Set RegistryObject = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
RegistryObject.EnumKey HKEY_CLASSES_ROOT, "CLSID", entryArray
ActiveSheet.Cells(1, 1).Value = "CLSID"
ActiveSheet.Cells(1, 2).Value = "ProgID"
row = 2
For x = 0 To UBound(entryArray)
RegistryObject.getstringvalue HKEY_CLASSES_ROOT, "CLSID\" & entryArray(x) & "\ProgId", "", KeyValue
If KeyValue <> "" Then
ActiveSheet.Cells(row, 1) = entryArray(x)
ActiveSheet.Cells(row, 2) = KeyValue
row = row + 1
End If
Next x
End Sub
In post #545 , ( #15 here ) I slightly rearrange those routines above, ( mine and Mike’s Clsid list thing making codings) , just to make them easier to compare, and then in post #547 , ( #17 here) I do Some initial comparison thoughts
So at this point in the discursions here in this post, there is what look potentially two very similar codings, one got from me after eating too much Panzerschokolade a few years back, and the other from Mike. (I doubt the English piss bier he drinks helps like Panzerschokolade does me, rather I have a feeling he may be one of the last people on the planet knows a useful thing or two)
But there is an important difference in the two: Both get the { curly bracket quid/Clsid stuff }, But he also gets a "ProgID" ????
By the way, back then, partly as I only got the { curly bracket quid/Clsid stuff } , I did myself the coding below to create an object from the Clsid and then look at the TypeName( object ) . I did that as a geuss on how to get the class name, if it had one. More about that abortion Later
Code:
' https://powershell.one/wmi/root/cimv2/stdregprov-EnumKey ' https://www.vbforums.com/showthread.php?552899-Getting-all-sub-keys-from-a-registry-value
Sub CLSIDsValueNames() '
Dim Ws As Worksheet: Set Ws = Me ' Set Ws = ActiveSheet
Dim RngSel As Range: Set RngSel = Selection
If RngSel.Cells.Count = 1 Then MsgBox prompt:="Please select at least 2 cells in column A": Exit Sub
If RngSel.Cells.Columns.Count <> 1 Then MsgBox prompt:="Please select at least 2 cells in only column A": Exit Sub
If Not RngSel.Cells.Column = 1 Then MsgBox prompt:="Please select at least 2 cells in column A": Exit Sub
Dim stearCel As Range
For Each stearCel In RngSel
Let Ws.Range("B" & stearCel.row & "").Value = "Tried" ' To indicate I tried - this can be useful to see where it crashed
Dim OOPObj As Object
On Error GoTo EyeEyeSkipper
Set OOPObj = CreateObject("New:" & stearCel.Value & "")
Let Ws.Range("D" & stearCel.row & "").Value = TypeName(OOPObj)
Let Application.DisplayAlerts = False
ThisWorkbook.Save ' This is done to save all got so far incase Excel crashes on next loop or below
Let Application.DisplayAlerts = True
On Error Resume Next
OOPObj.Close
On Error GoTo 0
Set OOPObj = Nothing
EyeEyeSkipper:
On Error GoTo -1
On Error GoTo 0
Next stearCel
End Sub
Bookmarks