Get full size properties (& perhaps a few other properties) using VBA of things in folders

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by SpeakEasy »

>whatever, that I am missing on my XP machines

What you are missing is a later, non-XP version of shell32. There is no version of shell32 available for XP that supports the interfaces necessary for the System. properties.

XP uses an earlier interface (essentially the one that supplies the info for GetDetailsOf), known as iColumnProvider. Shell32 in Vista onwards use the Windows Property System (i.e the System. stuff).

So, on XP you have feed ExtendedProperties with the same strings as you'd feed to GetDetailsOf

> GUID ... I also have used them as a way to Late bind

Well ... sort of. See 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 m y 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. So that should give you something new to Google ...

User avatar
DocAElstein
4StarLounger
Posts: 587
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by DocAElstein »

OK, thanks, that is good to know, I think that means there is no easy way to solve my XP problem. No big deal, I have a solution.
( I suppose copying some shell related program files or similar from a Vista upwards machine and putting them in a corresponding shell place on a XP machine is too naïve or too dangerous to be worth considering? )

In fact, maybe I already got the preferred solution …… because…. I had been thinking the
ExtendedProperties, (Propherkeys ( like used in objWSOPassName.ExtendedProperty("System." & "Size") ) )
, were the more fundamental stuff, since they gave that impression, and that is why in my desire to be fundamental and retro, ( only as regards MS Windows , vans, and a few other things ) , lead me to want a solution using them.
But it sounds now, in fact, that the
Properties ( like used in objWSOFolder.GetDetailsOf(FldrItm, 1) )
, are the earlier stuff, in which case I should stay with them anyway, ( although I will keep looking at the ExtendedProperties, (Propherkeys), for a while to check our exactly what info is available. It may reveal something, ( something more, - I already got some useful stuff out that I had not noticed using the Properties previously).

( One thing that threw me off, is that the Propherkeys seemed, all things considered, better than the Properties, ( until the XP issue), which goes against the usual run of these things with Microsoft, ( just in my experience, IMHO. - Perhaps I may not see the much bigger picture showing that they are getting better in something, what I experience more often gets worse )

_.___________________
SpeakEasy wrote:
04 Mar 2024, 13:49
... 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.
Yes, thanks! - that has jogged my memory. That is exactly what I was doing, or at least that is where in the registry I was getting them from. - I had been curious that a few people had found a way to use those as another way to Late Bind an object. But nobody could either get me a way to get a list of those***, either on their own, or better still a two column list showing what object they belonged to. Also, so far, no one who has managed to do it ( get one of those {numbers} to work in the GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") to late bind an object ) wanted to tell me how they did it, or where they found it from. (Maybe they stumbled on it by accident and were waiting to think of some plausible theory to pretend they got it in some clever planned way, as these people sometimes do, Lol )

*** But I did find some lists, one way or another, and was running a program to try to use them and then see what they did, for example set an object. That is when sometimes attempting that seemed to initiate or make things on my computer, so I backed off for a while. I am not sure if I want to start again in that, maybe, - I have a few more computers in the meantime, so breaking them is a little less serious.


All good stuff, thanks, its helping me get somewhere, (not quite sure where yet, :) , I might know when I get there )
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by SpeakEasy »

>another way to Late Bind

Well, early or late binding, actually.

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.

>a two column list showing what object they belonged to

Should be able top query the registry for this



*More accurately the userform dataobject, (Microsoft.Vbe.Interop.Forms.DataObjectClass - this is NOT a ProgID) which provides simple access to the clipboard
Last edited by SpeakEasy on 04 Mar 2024, 17:08, edited 1 time in total.

User avatar
DocAElstein
4StarLounger
Posts: 587
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by DocAElstein »

SpeakEasy wrote:
04 Mar 2024, 16:40
....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.
Yes, I think hearing something similar to that at the time was what set me off,- I expect at the time I may have been trying to see what else useful that I might find, but then got a bit more than I wanted/ had bitten off a bit more than I could chew, so retreated to re group and fight another day. The experience put me off thinking too much for a while about those {long character strings in curly bracket things}

Ref: Scids, aHoy aHoy
https://www.youtube.com/watch?v=DDg1hy6VhxY&t=110s
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by SpeakEasy »

>two column list

Code: Select all

Option Explicit
Public Const HKEY_CLASSES_ROOT = &H80000000

Public Sub GetCLSIDs_and_ProgIDs()

    Dim entryArray() As Variant
    Dim KeyValue  As String
    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
Last edited by SpeakEasy on 05 Mar 2024, 14:04, edited 1 time in total.

User avatar
DocAElstein
4StarLounger
Posts: 587
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by DocAElstein »

Thanks
I have tried the coding out on a few computers, XP – win 11 , a few Office versions etc.
With the exception of XP I am getting the same errors

I have not tried anything yet to find out what is wrong, I thought I would post the results first in case it’s something obvious that I am missing.

Results
_1 All computers and systems if I include Option Explicit :-
It don’t like the HKEY_CLASSES_ROOT https://i.postimg.cc/MGLHNzXv/Option-Ex ... S-ROOT.jpg
Option Explicit it dont like HKEY_CLASSES_ROOT.JPG

_2 No Option Explicit, - results for Vista upwards:_
I think that array, entryArray, aint being filled https://i.postimg.cc/tTVJH8VD/No-Option ... -range.jpg
No Option Explicit, Subscript out of range.JPG


( XP, for no Option Explicit, has an error that seems familiar, I seen it a few times recently : Automation-errors-The-called-object-has-been-disconnected-from-the-clients
https://i.postimg.cc/43ynWYfD/Automatio ... lients.jpg
)
You do not have the required permissions to view the files attached to this post.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by HansV »

At the top of the module, under Option Explicit, insert

Code: Select all

Public Const HKEY_CLASSES_ROOT = &H80000000
Best wishes,
Hans

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by SpeakEasy »

Oops, mea culpa. Missed the declaration. I'm going to edit the original post to include it.

User avatar
DocAElstein
4StarLounger
Posts: 587
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by DocAElstein »

Thanks , Hans, that seems initially to have got the thing going for me in Windows 10 and 11



Vista and Windows 7 have gone over to the same error as XP : Automation-errors-The-called-object-has-been-disconnected-from-the-clients

Windows 7
Win 7 Automation error.JPG


Vista
Vista Automation errors The called object has been disconnected from the clients.JPG

XP
XP error .jpg
( For what I want that is not a big problem, as I wanted the list which I got, but maybe that XP Vista Win 7 error may be an indication of something I don’t know what yet.
I have not tested on all my computers, but if I don’t post back to correct then that result will stand ,
- working in Windows 10 and 11
, Automation errors for XP Vista Win 7)
EDIT - see next posts
You do not have the required permissions to view the files attached to this post.
Last edited by DocAElstein on 05 Mar 2024, 18:34, edited 1 time in total.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
SpeakEasy
4StarLounger
Posts: 550
Joined: 27 Jun 2021, 10:46

Re: Get full size properties (& perhaps a few other properties) using VBA of things in folders

Post by SpeakEasy »

>or may be an indication of something I don’t know what yet

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

Simply change the declaration of KeyValue from

Dim KeyValue As String

to

Dim KeyValue As Variant

User avatar
DocAElstein
4StarLounger
Posts: 587
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Ahoy ,aHoy, Getcha {windows registry HKEY_CLASSES_ROOT clSids} here, and there, and there, an …..

Post by DocAElstein »

Yep, great , that seems initially to get it going for me now across the entire range, XP Vista Win7 Win8.1 Win10 Win11
Good stuff, Thanks.


Edit April 2024: Clsid codings update:
https://eileenslounge.com/viewtopic.php ... 05#p316705
https://eileenslounge.com/viewtopic.php ... 04#p316704
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(