Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Can you describe your security settings? I changed my Internet Options control panel Internet zone to High with no change. Is JavaScript active for you? I could not locate the setting to change it (I don't use IE). I'm on Win7 as well and your code works for me, so I'm going to need to replicate the settings on your system that lead to the crash, but first, we can narrow down where the problem lies:
Please compile and run the ZIP I'm attaching. I have modified your project to log detailed debug information. After, please attach the resulting log file to your reply. I'm also attaching the output from when I run it in case you want to compare it yourself. One thing I've noticed; you know you're zeroing out security id and zone values that weren't zero right? Just wanted to make sure you intended to change them.
Last edited by fafalone; Jul 5th, 2017 at 08:58 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
No, there's no conflict, except that it has a couple hidden members, so you need to specify oleexp.IUknown and oleexp.IDispatch if you're using those... IIRC it's only those two, but in any case definitely not any of the knownfolder stuff.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Update released with fix and completed new things.
Take note of a change to IContextMenu as it's very commonly used:
-IContextMenu and IContextMenu2: .InvokeCommand has been changed to a Long, so that both CMINVOKECOMMANDINFO and CMINVOKECOMMANDINFOEX can be used. Use VarPtr(yourcommandinfovar) instead of just yourcommandinfovar.
------------------------
TheTrick - I'd be very interested to see ITransferSource in action in VB; if possible, share code of it being used if you use it?
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Thanks for the new version!
I just wanted to mention that not all methods of KnownFolderManager can be called. I tried to retreive a list of registered known folders using GetFolderIds but the type definition for this method is not compatible with VB6, so it refused to compile.
So I changed the definition in exp_main.odl like this:
Now we are able to get the list using this demo snippet:
Code:
Sub TestKnownFolders()
Dim oMngr As oleexp.KnownFolderManager
Dim IFld As oleexp.IKnownFolder
Dim uid() As oleexp.UUID
Dim lUIDs As Long
Dim sGUID As String, sPath As String
Dim ret As Long, n As Long, i As Long
Dim lPath As Long, cnt As Long
Set oMngr = New oleexp.KnownFolderManager
oMngr.GetFolderIds lUIDs, n
If n > 0 Then
ReDim uid(n - 1)
For i = 0 To n - 1
oleexp.MoveMemory uid(i), ByVal (lUIDs + (i * 16)), 16&
sGUID = String(255, 0)
ret = oleexp.StringFromGUID2(uid(i), sGUID, 255)
If ret > 0 Then
sGUID = Left(sGUID, ret)
Set IFld = Nothing
oMngr.GetFolder uid(i), IFld
If Not IFld Is Nothing Then
On Error Resume Next
IFld.GetPath KF_FLAG_DEFAULT_PATH, lPath
On Error GoTo 0
If lPath <> 0 Then
cnt = cnt + 1
sPath = SysAllocString(lPath)
CoTaskMemFree lPath
Debug.Print cnt, sGUID, sPath
End If
End If
End If
Next i
End If
End Sub
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Thanks for pointing that out, the fix will be included in the next release.
Note too you can copy all the IDs at once, saving MoveMemory calls,
Code:
Dim ct As Long
Dim tpkd As KnownFolderManager
Set tpkd = New KnownFolderManager
Dim kfptr As Long
Dim arfldr() As UUID
tpkd.GetFolderIds kfptr, ct
ReDim arfldr(ct - 1)
CopyMemory arfldr(0), ByVal kfptr, Len(arfldr(0)) * ct
I can retrieve the display name (e.g. "Moto G (4)" or "Nexus 10") like this:
Code:
ret = MyPortableDeviceManager.GetDeviceDescription(sPnpDeviceID(i), VarPtr(bBuffer(0)), lenBuffer)
But how to retrieve the shell icon (the icon displayed in File Explorer)??? The
Portable Device API does not seem to provide anything here, at least I don't see
it.
Now in Win8.1 and earlier there is a way to retrieve the icon and some other
shell info using SHGetFileInfoW with a pidl (it does not work with a string,
only with pidl):
Code:
Call SHGetFileInfoW(pidlItem, 0&, sfiW, Len(sfiW), _
SHGFI_PIDL Or SHGFI_SYSICONINDEX Or SHGFI_TYPENAME Or SHGFI_DISPLAYNAME)
The desired icon is here now:
Code:
sfiW.iIcon
I can retrieve the needed pidl using SHParseDisplayName on the "PNP Device ID"
(prefixed with the This PC GUID "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and
one backslash):
Now the problem is: Retrieving that pidl stopped working with Windows 10 version
1703 (Creators Update) and later! I found no way to turn that "PNP Device ID"
into a pidl. BTW, I think that is a Windows bug and reported it to MS a year
ago, but never got any reply or fix.
So, how can I get my shell icon now in all Windows versions?
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Can you create an IShellItem? SHCreateItemFromParsingName. If it's visible with an icon in Explorer (and more importantly, check to see if my shell browser shows its icon), you should be able to get one. The first method my browser tries doesn't go through SHGetFileInfo (that's a fallback), it first tries getting the IShellIcon interface, and in the process gets pidls in a different way...
Code:
Dim uPI As IParentAndItem
Dim psf As IShellFolder
Dim pIcon As IShellIcon
Dim pidlPar As Long, pidlRel As Long
Dim lpIcon As Long
Dim hr As Long
'[...]
Set uPI = siChild 'Your IShellItem
uPI.GetParentAndItem pidlPar, psf, pidlRel
On Error Resume Next
If (psf Is Nothing) = False Then
Set pUnk = psf
hr = pUnk.QueryInterface(IID_IShellIcon, pIcon)
' DebugAppend "QueryInterface=0x" & Hex$(hr)
If hr = S_OK Then
pIcon.GetIconOf pidlRel, GIL_FORSHELL, lpIcon
Else
Dim pidlcb As Long
pidlcb = ILCombine(pidlPar, pidlRel)
lpIcon = GetFileIconIndexPIDL(pidlcb, SHGFI_SMALLICON)
End If
If lpIcon = -1 Then lpIcon = 0
End If
If Explorer shows the icon, that will almost certainly work. Worst case scenario, you could enumerate the Computer folder and match it.
If Explorer doesn't, you're left with manually doing it. The documentation indicates there might be a DevIcon.fil file in the device root, which is a standard icon file you can load. Or, use the device resource key WPD_RESOURCE_ICON. If both of those fail, query for the generic type (WPD_DEVICE_TYPE), and load the default icon for that type.
(If 'all Windows versions' means even XP or earlier, the interface methods won't work)
Last edited by fafalone; Jun 16th, 2018 at 11:09 PM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by fafalone
Can you create an IShellItem? SHCreateItemFromParsingName.
No, SHCreateItemFromParsingName fails with 0x80070057 (E_INVALIDARG).
It's the same error as SHParseDisplayName returns when trying to get the pidl.
So I think something about the PNP Device ID might be wrong.
The pidl is correctly returned for this path (it's the PNP Device ID of "Moto G (4)"):
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
But it fails with E_INVALIDARG for the 2 subfolders of "Moto G (4)":
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{C8DB0001,,63831015424}
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by fafalone
... and more importantly, check to see if my shell browser shows its icon...
I ran your ucShellBrowse41 project both in Win8.1 and in Win10, each time using my Moto G phone as device to be browsed. Below you see the debug output. To me it looks like your project met exactly the same problem that made me post here: "No IShellItem" So your shell browser cannot browse those folders in Win10 (but it can in Win8.1).
What's happening there? Windows bug? Can it be worked around?
Code:
Win 8.1
~~~~~~~
Select device "Moto G (4)" in your Tree:
[20:49:53] CBD->SelChange
[20:49:53] DirNavigate item=9,sup=Falsch
[20:49:53] LVLoadFolder ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},m_sCurPath=C:\Users\Donald\Desktop\Desk\ucShellBrowse41\Demo,sPrevPath=,GrpMode=0
[20:49:53] PathAttrib=SFGAO_CANLINK,SFGAO_CANRENAME,SFGAO_FOLDER,SFGAO_HASPROPSHEET,SFGAO_HASSUBFOLDER,SFGAO_STORAGEANCESTOR,
[20:49:53] ProcessColumns pathidx=9
[20:49:53] ub=37last=C:\Users\Donald\Desktop\Desk\ucShellBrowse41\Demo,cur=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:49:53] MyComp::Get ShellView
[20:49:53] MyComp::Get FolderView
[20:49:53] Got colmgt,ct=4
[20:49:53] NameLookup=System.ItemNameDisplay
[20:49:53] NameLookup=System.ItemTypeText
[20:49:53] NameLookup=System.Size
[20:49:53] NameLookup=System.FreeSpace
[20:49:53] SetColumns(9)=
[20:49:53] SetColumns->Finished reconcile
[20:49:53] SetColumns->Remove System.DateModified
[20:49:53] InsertListColumn System.FreeSpace
[20:49:53] excol defwidth=160
DirChange ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:49:53] idxCB=9,lp=9
[20:49:53] pvCreateDetailPaneBkg.pidlPar=114425896,pidlrel=113577680
[20:49:53] pbh=56
[20:49:53] btm=56,cx=58,icn=58,sys=32
[20:49:53] Draw from JM
[20:49:53] Loaded 0 files and 2 folders
[20:49:53] MonitorPidl=116732936 ForPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
Select subfolder of device:
[20:50:38] Set IC flag = TRUE, item=0
[20:50:38] LVSetSelection full path=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:50:38] pvCreateItemDetailPane()
[20:50:38] ucWndProc->Error: Typen unverträglich, 0xD
[20:50:38] LVItemClick 0
[20:50:38] InfoTip Cnt=2
[20:50:38] PropsList=prop:System.FreeSpace;System.Capacity
[20:50:38] Prop=Freier Speicherplatz: 46,6 GB
[20:50:38] Prop=Gesamtgröße: 54,5 GB
Dbl-click subfolder of device:
[20:52:37] Got dblclk/ret
[20:52:37] LVSetSelection full path=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:37] LVDoubleClick idx=0,lp=1,file=Interner gemeinsamer Speicher
[20:52:37] LVDoubleClick.OpenFolder
[20:52:37] LVLoadFolder ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792},m_sCurPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},sPrevPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792},GrpMode=0
[20:52:37] PathAttrib=SFGAO_FOLDER,SFGAO_HASPROPSHEET,SFGAO_HASSUBFOLDER,SFGAO_STORAGE,SFGAO_STORAGEANCESTOR,
[20:52:37] ProcessColumns pathidx=38
[20:52:37] ub=38last=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792},cur=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:37] MyComp::Get ShellView
[20:52:37] MyComp::Get FolderView
[20:52:37] Got colmgt,ct=8
[20:52:37] NameLookup=System.ItemNameDisplay
[20:52:37] NameLookup=System.ItemTypeText
[20:52:37] NameLookup=System.Size
[20:52:37] NameLookup=System.Music.TrackNumber
[20:52:37] NameLookup=System.Music.Artist
[20:52:37] NameLookup=System.Music.AlbumTitle
[20:52:37] NameLookup=System.Media.Year
[20:52:37] NameLookup=
[20:52:37] No match, pkey={9E5E05AC-1936-4A75-94F7-4704B8B01923, 6}
[20:52:37] NameLookup=
[20:52:37] No match, pkey={9E5E05AC-1936-4A75-94F7-4704B8B01923, 13}
[20:52:37] NameLookup=
[20:52:37] No match, pkey={9E5E05AC-1936-4A75-94F7-4704B8B01923, 14}
[20:52:37] NameLookup=
[20:52:37] SetColumns(38)=
[20:52:37] SetColumns->Finished reconcile
[20:52:37] SetColumns->Remove System.FreeSpace
[20:52:37] InsertListColumn System.Media.Year
[20:52:37] excol defwidth=80
[20:52:37] InsertListColumn System.Music.AlbumTitle
[20:52:37] excol defwidth=136
[20:52:37] InsertListColumn System.Music.Artist
[20:52:37] excol defwidth=120
[20:52:37] InsertListColumn System.Music.TrackNumber
[20:52:37] excol defwidth=40
DirChange ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:37] idxCB=10,lp=38
[20:52:37] pvCreateDetailPaneBkg.Error->Typen unverträglich, 0xD
[20:52:37] Loaded 0 files and 15 folders
[20:52:37] MonitorPidl=123149952 ForPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,,58525089792}
[20:52:41] terminate event
========================================================================
Win 10
~~~~~~
Select device "Moto G (4)" in your Tree:
[20:57:45] CBD->SelChange
[20:57:45] DirNavigate item=9,sup=Falsch
[20:57:45] LVLoadFolder ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},m_sCurPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33},sPrevPath=C:\Users\Public\ucShellBrowse41\Demo,GrpMode=0
[20:57:46] PathAttrib=SFGAO_CANLINK,SFGAO_CANRENAME,SFGAO_FOLDER,SFGAO_HASPROPSHEET,SFGAO_HASSUBFOLDER,SFGAO_STORAGEANCESTOR,
[20:57:46] ProcessColumns pathidx=9
[20:57:46] ub=21last=C:\Users\Public\ucShellBrowse41\Demo,cur=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:57:46] MyComp::Get ShellView
[20:57:46] MyComp::Get FolderView
[20:57:46] Got colmgt,ct=4
[20:57:46] NameLookup=System.ItemNameDisplay
[20:57:46] NameLookup=System.ItemTypeText
[20:57:46] NameLookup=System.Size
[20:57:46] NameLookup=System.FreeSpace
[20:57:46] SetColumns(9)=
[20:57:46] SetColumns->Finished reconcile
[20:57:46] ucShellBrowse.SetColumns->Error: Objektvariable oder With-Blockvariable nicht festgelegt, 0x5B
DirChange ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
[20:57:46] idxCB=9,lp=9
[20:57:46] pvCreateDetailPaneBkg.pidlPar=122406272,pidlrel=121952800
[20:57:46] pbh=56
[20:57:46] btm=56,cx=58,icn=58,sys=32
[20:57:46] Draw from JM
[20:57:46] Loaded 0 files and 2 folders
[20:57:46] MonitorPidl=139257568 ForPath=::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
Select subfolder of device:
[20:55:37] Set IC flag = TRUE, item=0
[20:55:37] LVSetSelection->Error: Objektvariable oder With-Blockvariable nicht festgelegt, 0x5B
[20:55:37] pvCreateItemDetailPane()
[20:55:37] LVItemClick 0
[20:55:38] No IShellItem
Dbl-click subfolder of device:
[20:56:36] Got dblclk/ret
[20:56:36] LVSetSelection->Error: Objektvariable oder With-Blockvariable nicht festgelegt, 0x5B
[20:56:36] LVDoubleClick idx=0,lp=1,file=Interner gemeinsamer Speicher
[20:56:36] LVDoubleClick->Failed to get IShellItem from parsing name
[20:56:36] No IShellItem
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
I thought the issue was the device icon? Does the device icon show? It should, since that output looks like the device is present in the Computer folder and the dropdown. It looks like the problem is just with subfolders; do their icons show when you navigate to the device root?
Wondering because if the root works ok, can we work around by using resolving with an IShellFolder always for the root and an relative pidl from there.
If it's working in Win8.1, it definitely sounds like a bug in the APIs though. Just one other thought... what about passing the display names 'Internet...' instead of 'SID-...' after the root?
I'll check it out myself in a bit, it's a cell phone or tablet right? Connected mine (also Android) as both file transfer and camera and could go as deep as I wanted without issue on Win7 too; I'll have to check on my roomies Win10 laptop later.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by fafalone
I thought the issue was the device icon? Does the device icon show? It should, since that output looks like the device is present in the Computer folder and the dropdown. It looks like the problem is just with subfolders; do their icons show when you navigate to the device root?
Wondering because if the root works ok, can we work around by using resolving with an IShellFolder always for the root and an relative pidl from there.
If it's working in Win8.1, it definitely sounds like a bug in the APIs though. Just one other thought... what about passing the display names 'Internet...' instead of 'SID-...' after the root?
I'll check it out myself in a bit, it's a cell phone or tablet right? Connected mine (also Android) as both file transfer and camera and could go as deep as I wanted without issue on Win7 too; I'll have to check on my roomies Win10 laptop later.
I need the pidl for the icon and also for other things, my post was indead misleading here, sorry.
Yes, in your browser the device icon shows, and also the icons in the next sub level. But then it does not go down any deeper.
> Just one other thought... what about passing the display names 'Internet...' instead of 'SID-...' after the root?
I don't know what inspired you to this but it's exactly what I found out yesterday night by a mixture of internet and conincidence. It looks promising! I'll report back later...
BTW, although I subscribed to the topic I never get email notifications from this forum. Is this normal?
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Problem solved!
Display path:
Code:
Moto G (4)\SD-Karte von SanDisk\Test\IMG_0001.JPG
This device path works in Win10 (but not in Win8.1):
Code:
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_22b8&pid_2e82#zy223nmx76#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SD-Karte von SanDisk\Test\IMG_0001.JPG
This device path works in Win8.1 (but not in Win10):
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Glad it worked out. I'll have to exceptions to handle this all over now too
Had the idea because of a vaguely similar issue with recycle bin files a while back; can't recall the specifics.
PS- For notifications, is the master option to receive e-mails enabled?
Last edited by fafalone; Jun 22nd, 2018 at 09:11 PM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
@fafalone:
MSDN for IPortableDeviceManager::GetDevices says on pPnPDeviceIDs: "To learn the required size for this parameter, first call this method with this parameter set to NULL and pcPnPDeviceIDs set to zero".
I think I have to pass 0& ByVal, right?
Code:
ret = MyPortableDeviceManager.GetDevices(ByVal 0&, cPnPDeviceIDs)
Or should it be like this:
Code:
ret = MyPortableDeviceManager.GetDevices(0&, cPnPDeviceIDs)
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
@voxy That parameter is ByVal so it wouldn't matter either way.
Code:
interface IPortableDeviceManager : stdole.IUnknown {
long GetDevices(
[in] long pPnPDeviceIDs,
[in] long *pcPnPDeviceIDs);
@ChenLin, you can't reference the TLB in .NET? Is it this specific typelib or all the typelibs specifically designed for VB6? I don't have time to try running code right now but I did add the TLB as a reference without error in a VB.NET project in VS2015... I'll try to run some code with it tonight.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
OK, just saw that apparently function parameters in typelibs never show "ByVal" even if they are ByVal. So one cannot know what they are, ByVal or ByRef, without looking into the source code of the typelib?
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
@voxy, that's unfortunately true. Sometimes there's clues in the naming conventions; and as a general rule, almost always the convention oleexp uses is to replace ByRef's for strings with ByVal and string pointers, for Unicode purposes, which is why the naming convention is broken here (it's byref in the original source as is the convention for vars prefixed with 'p').
@ChenLin, so not when you add the TLB but when you try to run the code? Are you calling an interface not available on the current version of Windows?
Last edited by fafalone; Jul 11th, 2018 at 05:25 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Of the typelib?
Can you be more specific about what exactly the error message is and when it appears?
The only difference between 3.7 and 4.43 are added interfaces/types; there haven't been any changes to the TLB structure itself since long before that.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Please look at the picture。
Debug error prompt:
Severity Code Description Project File Line Suppression State
Error Could not resolve COM reference "f9015e81-caac-45c0-94e8-42b7da5d7557" version 4.43. The type library importer encountered an error during type verification. Try importing without class members.
Last edited by ChenLin; Jul 12th, 2018 at 09:39 PM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
It looks like the file is in a different location than its registered to. Perhaps try unregistering then reregistering? This problem could arise if earlier 4.x versions in a different location were ever used.
There was also some IDs from Win10 version 1709, but I didn't list them because I think they are useless since they marked as:
Originally Posted by MSDN
This FOLDERID is used internally by .NET applications to enable cross-platform app functionality. It is not intended to be used directly from an application.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
I'm not sure about that error with static data; haven't encountered it before myself. My first thought would be a potential problem with referencing too many at once... is it happening in a project where you're using a whole lot of them? It would have to really be a lot some of my bigger projects use a few dozen of them.
FOLDERIDs Added; will be in next release. Give me a couple days, going to add the interface set you mentioned, a couple shell extention service interfaces I missed, and was going to look at possibly adding the ITbS.. remote desktop services and virtual disk services.
If you want to copy/paste for now I already ran them through my IID function builder:
Code:
Public Function FOLDERID_AccountPictures() As UUID
'{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H008ca0b1, CInt(&H55b4), CInt(&H4c56), &Hb8, &Ha8, &H4d, &He4, &Hb2, &H99, &Hd3, &Hbe)
FOLDERID_AccountPictures = iid
End Function
Public Function FOLDERID_AppDataDesktop() As UUID
'{B2C5E279-7ADD-439F-B28C-C41FE1BBF672}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HB2C5E279, CInt(&H7ADD), CInt(&H439F), &HB2, &H8C, &HC4, &H1F, &HE1, &HBB, &HF6, &H72)
FOLDERID_AppDataDesktop = iid
End Function
Public Function FOLDERID_ApplicationShortcuts() As UUID
'{A3918781-E5F2-4890-B3D9-A7E54332328C}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA3918781, CInt(&HE5F2), CInt(&H4890), &HB3, &HD9, &HA7, &HE5, &H43, &H32, &H32, &H8C)
FOLDERID_ApplicationShortcuts = iid
End Function
Public Function FOLDERID_AppsFolder() As UUID
'{1e87508d-89c2-42f0-8a7e-645a0f50ca58}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H1e87508d, CInt(&H89c2), CInt(&H42f0), &H8a, &H7e, &H64, &H5a, &H0f, &H50, &Hca, &H58)
FOLDERID_AppsFolder = iid
End Function
Public Function FOLDERID_CameraRoll() As UUID
'{AB5FB87B-7CE2-4F83-915D-550846C9537B}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HAB5FB87B, CInt(&H7CE2), CInt(&H4F83), &H91, &H5D, &H55, &H08, &H46, &HC9, &H53, &H7B)
FOLDERID_CameraRoll = iid
End Function
Public Function FOLDERID_DeviceMetadataStore() As UUID
'{5CE4A5E9-E4EB-479D-B89F-130C02886155}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H5CE4A5E9, CInt(&HE4EB), CInt(&H479D), &HB8, &H9F, &H13, &H0C, &H02, &H88, &H61, &H55)
FOLDERID_DeviceMetadataStore = iid
End Function
Public Function FOLDERID_DocumentsLibrary() As UUID
'{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H7B0DB17D, CInt(&H9CD2), CInt(&H4A93), &H97, &H33, &H46, &HCC, &H89, &H02, &H2E, &H7C)
FOLDERID_DocumentsLibrary = iid
End Function
Public Function FOLDERID_HomeGroupCurrentUser() As UUID
'{9B74B6A3-0DFD-4f11-9E78-5F7800F2E772}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H9B74B6A3, CInt(&H0DFD), CInt(&H4f11), &H9E, &H78, &H5F, &H78, &H00, &HF2, &HE7, &H72)
FOLDERID_HomeGroupCurrentUser = iid
End Function
Public Function FOLDERID_ImplicitAppShortcuts() As UUID
'{BCB5256F-79F6-4CEE-B725-DC34E402FD46}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HBCB5256F, CInt(&H79F6), CInt(&H4CEE), &HB7, &H25, &HDC, &H34, &HE4, &H02, &HFD, &H46)
FOLDERID_ImplicitAppShortcuts = iid
End Function
Public Function FOLDERID_Libraries() As UUID
'{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H1B3EA5DC, CInt(&HB587), CInt(&H4786), &HB4, &HEF, &HBD, &H1D, &HC3, &H32, &HAE, &HAE)
FOLDERID_Libraries = iid
End Function
Public Function FOLDERID_MusicLibrary() As UUID
'{2112AB0A-C86A-4FFE-A368-0DE96E47012E}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H2112AB0A, CInt(&HC86A), CInt(&H4FFE), &HA3, &H68, &H0D, &HE9, &H6E, &H47, &H01, &H2E)
FOLDERID_MusicLibrary = iid
End Function
Public Function FOLDERID_Objects3D() As UUID
'{31C0DD25-9439-4F12-BF41-7FF4EDA38722}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H31C0DD25, CInt(&H9439), CInt(&H4F12), &HBF, &H41, &H7F, &HF4, &HED, &HA3, &H87, &H22)
FOLDERID_Objects3D = iid
End Function
Public Function FOLDERID_PicturesLibrary() As UUID
'{A990AE9F-A03B-4E80-94BC-9912D7504104}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA990AE9F, CInt(&HA03B), CInt(&H4E80), &H94, &HBC, &H99, &H12, &HD7, &H50, &H41, &H04)
FOLDERID_PicturesLibrary = iid
End Function
Public Function FOLDERID_PublicLibraries() As UUID
'{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H48DAF80B, CInt(&HE6CF), CInt(&H4F4E), &HB8, &H00, &H0E, &H69, &HD8, &H4E, &HE3, &H84)
FOLDERID_PublicLibraries = iid
End Function
Public Function FOLDERID_PublicRingtones() As UUID
'{E555AB60-153B-4D17-9F04-A5FE99FC15EC}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HE555AB60, CInt(&H153B), CInt(&H4D17), &H9F, &H04, &HA5, &HFE, &H99, &HFC, &H15, &HEC)
FOLDERID_PublicRingtones = iid
End Function
Public Function FOLDERID_PublicUserTiles() As UUID
'{0482af6c-08f1-4c34-8c90-e17ec98b1e17}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H0482af6c, CInt(&H08f1), CInt(&H4c34), &H8c, &H90, &He1, &H7e, &Hc9, &H8b, &H1e, &H17)
FOLDERID_PublicUserTiles = iid
End Function
Public Function FOLDERID_RecordedTVLibrary() As UUID
'{1A6FDBA2-F42D-4358-A798-B74D745926C5}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H1A6FDBA2, CInt(&HF42D), CInt(&H4358), &HA7, &H98, &HB7, &H4D, &H74, &H59, &H26, &HC5)
FOLDERID_RecordedTVLibrary = iid
End Function
Public Function FOLDERID_Ringtones() As UUID
'{C870044B-F49E-4126-A9C3-B52A1FF411E8}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HC870044B, CInt(&HF49E), CInt(&H4126), &HA9, &HC3, &HB5, &H2A, &H1F, &HF4, &H11, &HE8)
FOLDERID_Ringtones = iid
End Function
Public Function FOLDERID_RoamedTileImages() As UUID
'{AAA8D5A5-F1D6-4259-BAA8-78E7EF60835E}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HAAA8D5A5, CInt(&HF1D6), CInt(&H4259), &HBA, &HA8, &H78, &HE7, &HEF, &H60, &H83, &H5E)
FOLDERID_RoamedTileImages = iid
End Function
Public Function FOLDERID_RoamingTiles() As UUID
'{00BCFC5A-ED94-4e48-96A1-3F6217F21990}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H00BCFC5A, CInt(&HED94), CInt(&H4e48), &H96, &HA1, &H3F, &H62, &H17, &HF2, &H19, &H90)
FOLDERID_RoamingTiles = iid
End Function
Public Function FOLDERID_SavedPictures() As UUID
'{3B193882-D3AD-4eab-965A-69829D1FB59F}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H3B193882, CInt(&HD3AD), CInt(&H4eab), &H96, &H5A, &H69, &H82, &H9D, &H1F, &HB5, &H9F)
FOLDERID_SavedPictures = iid
End Function
Public Function FOLDERID_SavedPicturesLibrary() As UUID
'{E25B5812-BE88-4bd9-94B0-29233477B6C3}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HE25B5812, CInt(&HBE88), CInt(&H4bd9), &H94, &HB0, &H29, &H23, &H34, &H77, &HB6, &HC3)
FOLDERID_SavedPicturesLibrary = iid
End Function
Public Function FOLDERID_Screenshots() As UUID
'{b7bede81-df94-4682-a7d8-57a52620b86f}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &Hb7bede81, CInt(&Hdf94), CInt(&H4682), &Ha7, &Hd8, &H57, &Ha5, &H26, &H20, &Hb8, &H6f)
FOLDERID_Screenshots = iid
End Function
Public Function FOLDERID_SearchHistory() As UUID
'{0D4C3DB6-03A3-462F-A0E6-08924C41B5D4}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H0D4C3DB6, CInt(&H03A3), CInt(&H462F), &HA0, &HE6, &H08, &H92, &H4C, &H41, &HB5, &HD4)
FOLDERID_SearchHistory = iid
End Function
Public Function FOLDERID_SearchTemplates() As UUID
'{7E636BFE-DFA9-4D5E-B456-D7B39851D8A9}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H7E636BFE, CInt(&HDFA9), CInt(&H4D5E), &HB4, &H56, &HD7, &HB3, &H98, &H51, &HD8, &HA9)
FOLDERID_SearchTemplates = iid
End Function
Public Function FOLDERID_SkyDrive() As UUID
'{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA52BBA46, CInt(&HE9E1), CInt(&H435f), &HB3, &HD9, &H28, &HDA, &HA6, &H48, &HC0, &HF6)
FOLDERID_SkyDrive = iid
End Function
Public Function FOLDERID_SkyDriveCameraRoll() As UUID
'{767E6811-49CB-4273-87C2-20F355E1085B}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H767E6811, CInt(&H49CB), CInt(&H4273), &H87, &HC2, &H20, &HF3, &H55, &HE1, &H08, &H5B)
FOLDERID_SkyDriveCameraRoll = iid
End Function
Public Function FOLDERID_SkyDriveDocuments() As UUID
'{24D89E24-2F19-4534-9DDE-6A6671FBB8FE}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H24D89E24, CInt(&H2F19), CInt(&H4534), &H9D, &HDE, &H6A, &H66, &H71, &HFB, &HB8, &HFE)
FOLDERID_SkyDriveDocuments = iid
End Function
Public Function FOLDERID_SkyDrivePictures() As UUID
'{339719B5-8C47-4894-94C2-D8F77ADD44A6}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H339719B5, CInt(&H8C47), CInt(&H4894), &H94, &HC2, &HD8, &HF7, &H7A, &HDD, &H44, &HA6)
FOLDERID_SkyDrivePictures = iid
End Function
Public Function FOLDERID_UserPinned() As UUID
'{9E3995AB-1F9C-4F13-B827-48B24B6C7174}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H9E3995AB, CInt(&H1F9C), CInt(&H4F13), &HB8, &H27, &H48, &HB2, &H4B, &H6C, &H71, &H74)
FOLDERID_UserPinned = iid
End Function
Public Function FOLDERID_UserProgramFiles() As UUID
'{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H5CD7AEE2, CInt(&H2219), CInt(&H4A67), &HB8, &H5D, &H6C, &H9C, &HE1, &H56, &H60, &HCB)
FOLDERID_UserProgramFiles = iid
End Function
Public Function FOLDERID_UserProgramFilesCommon() As UUID
'{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HBCBD3057, CInt(&HCA5C), CInt(&H4622), &HB4, &H2D, &HBC, &H56, &HDB, &H0A, &HE5, &H16)
FOLDERID_UserProgramFilesCommon = iid
End Function
Public Function FOLDERID_UsersLibraries() As UUID
'{A302545D-DEFF-464b-ABE8-61C8648D939B}
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &HA302545D, CInt(&HDEFF), CInt(&H464b), &HAB, &HE8, &H61, &HC8, &H64, &H8D, &H93, &H9B)
FOLDERID_UsersLibraries = iid
End Function
Public Function FOLDERID_VideosLibrary() As UUID
'{491E922F-5643-4AF4-A7EB-4E7A138D8174 }
Static iid As UUID
If (iid.Data1 = 0&) Then Call DEFINE_UUID(iid, &H491E922F, CInt(&H5643), CInt(&H4AF4), &HA7, &HEB, &H4E, &H7A, &H13, &H8D, &H81, &H74)
FOLDERID_VideosLibrary = iid
End Function
Last edited by fafalone; Jul 28th, 2018 at 03:22 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Hi, fafalone!
Nice! Thank you for that. BTW. I checked all of your another FOLDERID_* IDs. All of them are correct.
I'm not sure about that error with static data; haven't encountered it before myself. My first thought would be a potential problem with referencing too many at once... is it happening in a project where you're using a whole lot of them? It would have to really be a lot some of my bigger projects use a few dozen of them.
Right after adding to my project I used maybe only 1-2 of them. That compilation error began to happen randomly and not very often, but only after I already ran project at least once.
I also using many Static in my proj. However, I don't think they could be greater than even 1 KB in sum.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
New release is up (v4.5). There's a whole other set of new FOLDERID_ values not in the list posted above, so I've got both those and the new ones in mIID now. TaskScheduler interfaces added; there were actually a few VB6 incompatibilities that had to be changed; a couple arguments were 'unsigned long' and another had a double-pointer to an array (the same bug pointed out for IKnownFolderManager.GetFolderIds... I went through the entire project and found a bunch of these that needed changing, so extra thanks for finding that Dragokas).
PS- Per issue raised in PM, the base ITaskService interface is there, you just don't see it in Object Browser because it's the default interface for the TaskScheduler coclass.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Hi,
I wanted to know has VB6 appropriate compatible type for replacing HRESULT.
Since, you didn't replace it e.g. in KnownFolderManager -> GetFolderIds, so maybe due the some reason?
I used that code and my version of tlb* and after several attempts I got IDE crash on program unload, so I added red warning.
I didn't try your new tlb yet, however plan to make more tests.
*sorry can't add hyperlink ("Something went wrong), it's a link to your "Code snippet: KnownFolders made easy with IKnownFolderManager" topic, my post #14.
Last edited by Dragokas; Aug 2nd, 2018 at 10:25 AM.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
You can replace any HRESULT with a long (byval, just long, not long*); I generally just leave it except where you really can't get by without knowing that return value, because while it's not applicable to IKnownFolderManager, switching it means you cannot use the interface with Implements, which is why oleexpimp and olelib2 before it exist. The vast majority of the time you can just check the expected output, like with GetFolderIds it failed if either the count or pointer are zero. But that's in general, here I had really forgotten that you wanted it changed to examine the specific return.. though it's not failing right? The return will be S_OK (0) unless it fails.
If there's a memory leak, it's not because HRESULT was changed to long. The most likely suspect is the array; MSDN says you need to 'free these resources' plural, so maybe just freeing the pointer isn't enough? Though first I'd check if there's still an issue when compiled.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Thank you for detail explanation.
because while it's not applicable to IKnownFolderManager, switching it means you cannot use the interface with Implements
Not understant. It's already implemented. What you mean?
here I had really forgotten that you wanted it changed to examine the specific return.
Yes, it's not important, bacause all of that methods can be checked by return values, as you already mentioned. So, in fact I have 2-level check.
MSDN says you need to 'free these resources' plural, so maybe just freeing the pointer isn't enough?
I will be grateful.
I used your FreeKnownFolderDefinitionFields() to free each element of array and CoTaskMemFree on ptr to that array. So, I dunno, what else can be wrong. My project just silently crash on pressing "X". I lost that my version, but I'll try to reproduce.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Ok, I was able to reproduce.
Look like, it's 2 my mistakes.
I set FreeKnownFolderDefinitionFields under "if" scope that check only first member.
However, FreeKnownFolderDefinitionFields is not need at all, because CoTaskMemFree + ptr to array free whole resourse.
Crash happened because I tried to free it twice.
Re: [VB6] Modern Shell Interface Type Library - oleexp.tlb
Originally Posted by Dragokas
Thank you for detail explanation.
Not understant. It's already implemented. What you mean?
Yes, it's not important, bacause all of that methods can be checked by return values, as you already mentioned. So, in fact I have 2-level check.
I will be grateful.
I used your FreeKnownFolderDefinitionFields() to free each element of array and CoTaskMemFree on ptr to that array. So, I dunno, what else can be wrong. My project just silently crash on pressing "X". I lost that my version, but I'll try to reproduce.
Was just talking about the default behavior. One would never use IKnownFolderManager with Implements, but most interfaces you might, so my default is to leave it at HRESULT. I'll change IKnownFolderManager to longs in the next version.