Is subclassing done differently in tB since you mentioned a "tB version"? Is it because tB can use the "AddressOf" operator with class methods, right? That surely does come in handy...
Printable View
Is subclassing done differently in tB since you mentioned a "tB version"? Is it because tB can use the "AddressOf" operator with class methods, right? That surely does come in handy...
Not just that, but self-subclassing techniques like the one originally used in the VB6 version (Paul Caton/LaVolpe ssc_Subclass), rely on assembly thunks that use undocument internal VB implementation hacks. Since tB isn't a just a reverse engineered VB, the internals differ, so the the self-sub thunks can't be used.
However tB supporting AddressOf on classes natively eliminates the need for such a hack, so you can replace it with more simple methods like SetWindowSubclass and direct callbacks. I did write a tB FAQ entry that clarifies that 'full compatibility' doesn't include undocumented internal implementation details.
Krool's subclassing works now with ucShellTree! :thumb:
I also had to add another subclassing function for the FocusTimer:
ucShellTree runs now without crashes on Windows Server editions with a strict DEP option. :thumb:Code:CTL:
Public Function zzz_FocusTimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal TimerID As Long, ByVal Tick As Long) As Long
MOD:
Public Function ShellTreeFocusTimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal TimerID As Long, ByVal Tick As Long, ByVal lFocusTimer As ucShellTree)
ShellTreeFocusTimerProc = lFocusTimer.zzz_FocusTimerProc(hWnd, uMsg, TimerID, Tick)
End Function
I tested the LabelEdit with a file and the IDE/exe is crashing when i rename the file. :sick:
The crash happens in the RenameFile function.
No crash occurred if i enter the label edit mode and not rename the file.
I guess this has something to do with the subclassing.
With ucShellTree v2.7 you unsubclassed the edit control at the beginning of TVN_ENDLABELEDITW in the function "ucWndProc".
The newer version do the unsubclass in the function "zzz_LabelEditWndProc" at WM_DESTROY.
Any ideas whats wrong here?
Yeah I think I added the focus timer stuff in a later version. You did it right, same as the others.
I'll try to take a look at the rename issue, but really you're getting just as good at working on ucShellTree as me :)
At Windows Server 2008 R2 i want to open the existing path "C:\Users\Administrator\AppData\Local\Temp\1" using ucTree.OpenToPath but it doesnt work because the folder "AppData" is hidden in the tree:
Attachment 190434
Control properties:
How to make the hidden folder visible?Code:ucTree.Autocheck = False
ucTree.AutoExpandComputer = False
ucTree.AutoExpandLibraries = False
ucTree.BorderStyle = STBS_None
ucTree.ComputerAsRoot = False
ucTree.DisableDragDrop = True
ucTree.DisableWow64Redirect = True
ucTree.EnableShellMenu = False
ucTree.ExclusionChecks = False
ucTree.ExpandZip = False
ucTree.FileExtensions = STEP_AlwaysShow
ucTree.HideControlPanel = True
ucTree.HideLibraries = False
ucTree.HideNetwork = False
ucTree.HideOneDrive = True
ucTree.HideRecycleBin = True
ucTree.IconSize = 16
ucTree.InfoTipOnFiles = False
ucTree.InfoTipOnFolders = False
ucTree.ItemFilterFilesOnly = True
ucTree.LabelEditRename = False
ucTree.MonitorDirChanges = False
ucTree.MultiSelect = False
ucTree.PlayNavigationSound = False
ucTree.RootHasCheckbox = False
ucTree.ShowFavorites = False
ucTree.ShowHiddenItems = STHP_AlwaysShow
ucTree.ShowOnlyDrives = False
ucTree.ShowOnlyFileCheckbox = True
ucTree.ShowQuickAccessOnWin10 = False
ucTree.ShowSelAlways = True
ucTree.ShowSuperHidden = STSHP_AlwaysShow
ucTree.SingleClickExpand = True
ucTree.SingleExpand = False
It seems thats the ShowHiddenItems/ShowSuperHidden properties not work correct with Server2008R2.
The folder is visible after i manually unide the items via the explorer configuration:
Attachment 190435
I will check this with other Server versions too...stay tuned
The problem with the hidden folder "AppData" goes along with Server2008R2, Server20212, Server2019 and Server2022.
Starting the exe with full admin rights doesnt change anything.
The folder isnt visible until i turn on hidden items for the windows explorer.
The control properties ShowHiddenItems/ShowSuperHidden have no effect.
Can this be fixed?
oh well, oh well, the AppData folder is also hidden with all workstation versions (7,8,10,11)!
Do the Shell APIs have to follow the Windows Explorer settings regarding the visible folder/file option or is this a bug in the code?
I guess i found the problem: in the function TVExpandFolder at line "siParent.BindToHandler 0&, BHID_EnumItems, IID_IEnumShellItems, pEnum" you init the enum object to get all items from a parent folder but i cant find the settings for the enum object using "STR_ENUM_ITEMS_FLAGS".
See:Quote:
STR_ENUM_ITEMS_FLAGS
Introduced in Windows 8. Specifies a SHCONTF value to be passed to IShellFolder::EnumObjects when you call IShellItem::BindToHandler with BHID_EnumItems.
- win32/desktop-src/shell/str-constants
- Customizing item enumeration with IShellItem
- Customizing item enumeration with IShellItem, the old-fashioned way
This infos should help you to add the enum items flags and make the properties ShowHiddenItems/ShowSuperHidden work correctly! :thumb:
It seems the shell item enums do work differently on the server editions; the initial enum doesn't include the hidden items like regular editions.
I was already writing that bind context function to test that out (I found out I didn't have *any* PSPropertyBag_ APIs written so I got distracted by that; so won't get around to testing until tomorrow now)... but the problem is that's only good for Windows 8 and up. 7 is still pretty popular among VB6 users.
The other method is just falling back to IShellFolder/IEnumIDList, which has its own drawbacks.
please read the above again ;)
We are not developing a usercontrol for VB6 users. The control will be used in an app by end-users that are mostly using Windows 10 and Windows 11:
Desktop Windows Version Market Share Worldwide - January 2024
Win10 66.45%
Win11 27.83%
Win7 3.06%
Win8.1 1.74%
If you don't need Win7 then yeah, bind context is a good option. But I couldn't do that for the main release except as maybe an optional that just proceeded normally if the call failed with the bindctx.
IF Win8 or Higher = True THEN use bindctx ELSE fall back to current standard
or add a new property like "ShowSuperMegaHiddenItems" that is available with Win8 or higher
ShowSuperMegaHiddenItems = false ' use the current standard
ShowSuperMegaHiddenItems = True ' use bindctx
btw, all my apps support Win7/Server2008R2 or higher.
Bad news I'm afraid... I got the bind context working fine; I tested it with include only folders and sure enough no files were enumerated. But it ignored the include hidden/superhidden flags, even while running as admin. I suspect there's a policy setting somewhere that's controlling this.
I didn't add conditionals since it was just a preliminary test;
The only alternative I can see at this point is toggling the explorer setting; I doubt IShellFolder would help here since SHCONTF flags are being ignored, and other enum methods wouldn't work with all the virtual objects like ThisPC. It would be possible to do like ucShellBrowse and have a different enum method available only for regular file system paths, but that's major rewrite territory; I'd be inclined to just tell users ucShellTree respects your settings here, deal with it. You could offer to toggle it permanently or per-run; if you're considering per-enum then I'd check whether changing it triggers a refresh of open windows; that could really interfere with the smoothness of it.Code:Public Declare PtrSafe Function CreateBindCtx Lib "ole32" (ByVal reserved As Long, ppbc As IBindCtx) As Long
Public Declare PtrSafe Function PSCreateMemoryPropertyStore Lib "propsys" (riid As UUID, ppv As Any) As Long
Public Declare PtrSafe Function PSPropertyBag_WriteDWORD Lib "propsys" (ByVal propBag As IPropertyBag, ByVal propName As LongPtr, ByVal value As Long) As Long
Dim pbc As IBindCtx
Dim hrbc As Long: hrbc = CreateBindCtx(0, pbc)
If (pbc Is Nothing) = False Then
Dim sppb As IPropertyBag
Dim spunk As IUnknownUnrestricted 'oleexp.IUnknown in VB6
hrbc = PSCreateMemoryPropertyStore(IID_IUnknown, spunk)
If SUCCEEDED(hrbc) Then
pbc.RegisterObjectParam StrPtr(STR_PROPERTYBAG_PARAM), spunk
Set sppb = spunk
If (sppb Is Nothing) = False Then
PSPropertyBag_WriteDWORD sppb, StrPtr(STR_ENUM_ITEMS_FLAGS), SHCONTF_FOLDERS Or SHCONTF_INCLUDEHIDDEN Or SHCONTF_INCLUDESUPERHIDDEN
Debug.Print "Wrote BindCtx dw"
Else
Debug.Print "QI for PropertyBag failed"
End If
Else
Debug.Print "PSCreateMemPstore failed"
End If
siParent.BindToHandler ObjPtr(pbc), BHID_EnumItems, IID_IEnumShellItems, pEnum
Else
siParent.BindToHandler 0, BHID_EnumItems, IID_IEnumShellItems, pEnum
End If
Check this code to use hidden/superhidden flags:
Full code here:Code:
...
hr = SHCreateItemFromIDList(pidlRoot, IID_IShellItem, pISI)
hr = pISI.BindToHandler(0, BHID_SFObject, IID__IShellFolder, pISF)
hr = pISF.EnumObjects(0, SHCONTF_CHECKING_FOR_CHILDREN Or SHCONTF_ENABLE_ASYNC Or SHCONTF_FASTITEMS Or SHCONTF_FLATLIST Or _
SHCONTF_FOLDERS Or SHCONTF_INCLUDEHIDDEN Or SHCONTF_INCLUDESUPERHIDDEN Or SHCONTF_INIT_ON_FIRST_NEXT Or _
SHCONTF_NAVIGATION_ENUM Or SHCONTF_NETPRINTERSRCH Or SHCONTF_NONFOLDERS Or SHCONTF_SHAREABLE Or _
SHCONTF_STORAGE, pEIDL)
If hr = S_OK Then
Do While pEIDL.Next(1, pidlEnum, 0) = S_OK
...
https://www.vbforums.com/showthread....it-s-to-slow!!
I did not test it, but it looks much more easy to implement the flags!
I tried to test the other enum method but BindToHandler returns always -2147467262 and i get no IShellFolder object.
Maybe my def of IID_IShellFolder is wrong?
new enum method:Code:Private Function IID_IShellFolder() As oleexp.UUID
'{000214E6-0000-0000-C000-000000046}
Static iid As oleexp.UUID
If (iid.Data1 = 0) Then Call DEFINE_UUID(iid, &H214E6, CInt(&H0), CInt(&H0), &HC0, &H0, &H0, &H0, &H0, &H0, &H0, &H46)
IID_IShellFolder = iid
End Function
the above code replaced the original code:Code:If (siParent Is Nothing) = False Then
Dim pISF As oleexp.IShellFolder
Dim pEIDL As oleexp.IEnumIDList
Dim pidlEnum As Long
Dim lReturn As Long
lReturn = siParent.BindToHandler(0&, BHID_SFUIObject, IID_IShellFolder, pISF) ' returns -2147467262
If (pISF Is Nothing) = False Then
lReturn = pISF.EnumObjects(UserControl.hWnd, SHCONTF_CHECKING_FOR_CHILDREN Or _
SHCONTF_FOLDERS Or _
SHCONTF_NONFOLDERS Or _
SHCONTF_INCLUDEHIDDEN Or _
SHCONTF_SHAREABLE Or _
SHCONTF_STORAGE Or _
SHCONTF_NAVIGATION_ENUM Or _
SHCONTF_FASTITEMS Or _
SHCONTF_INCLUDESUPERHIDDEN, _
pEIDL)
End If
If (pEIDL Is Nothing) = False Then
bFilling = True
tc1 = GetTickCount()
Do While pEIDL.Next(1&, pidlEnum, pcl) = S_OK
oleexp.SHCreateItemFromIDList pidlEnum, IID_IShellItem, siChild
Do you see whats wrong here?Code:siParent.BindToHandler 0&, BHID_EnumItems, IID_IEnumShellItems, pEnum
If (pEnum Is Nothing) = False Then
bFilling = True
tc1 = GetTickCount()
Do While pEnum.Next(1&, siChild, pcl) = S_OK
I fixed the problem with the error at BindToHandler: the other enum method uses BHID_SFObject with BindToHandler but the ucShellTree project doesnt know about this UUID. I can only chosse between BHID_DataObject, BHID_EnumItems and BHID_SFUIObject.
I added BHID_SFObject to solve the error:
Now i can run ucShellTree with the other enum method and the content of the desktop is fully enumerated and looks correct BUT:Code:Private Function BHID_SFObject() As oleexp.UUID
'https://doxygen.reactos.org/d0/d95/shlguid_8h.html
'DEFINE_GUID (BHID_SFObject, 0x3981E224, 0xF559, 0x11D3, 0x8E, 0x3A, 0x00, 0xC0, 0x4F, 0x68, 0x37, 0xD5)
Static iid As oleexp.UUID
If (iid.Data1 = 0) Then Call DEFINE_UUID(iid, &H3981E224, CInt(&HF559), CInt(&H11D3), &H8E, &H3A, &H0, &HC0, &H4F, &H68, &H37, &HD5)
BHID_SFObject = iid
End Function
- "This PC" is enumerated but only showing empty item names and the standard file icon.
- I can expand my HD drive D: but some folders (with subfolders) on this drive cannot expanded.
- i cannot expand my HD drive F: ...
Strange behavior...
I wish i could see my C: drive in the tree to test if the hidden AppData folder is now visible or not!
For me it looks like this enum method only works with real folders but not with GUID items.
What do you think?
I'm 99% sure IEnumShellItems is just implementing IShellFolder/IEnumIDList under the hood. As expected, it too ignored those flags. Not sure where you're going wrong, must be with the IIDs (I strongly advise against copying code from nebeln; he's had IID issues and others from his weird need to rewrite everything to avoid doing it the same way as me and all the giants I learned from). If you want to try yourself:
Note: That code is just to test whether the flags work; it's light on error handling and heavy on memory leaks.Code:Public Declare Function ILCombine Lib "shell32" (ByVal pidl1 As LongPtr, ByVal pidl2 As LongPtr) As LongPtr
Public Function BHID_SFObject() As UUID
'{0x3981E224, 0xF559, 0x11D3, 0x8E,0x3A, 0x00,0xC0,0x4F,0x68,0x37,0xD5}
Static iid As UUID
If (iid.Data1 = 0) Then Call DEFINE_UUID(iid, &H3981E224, &HF559, &H11D3, &H8E, &H3A, &H0, &HC0, &H4F, &H68, &H37, &HD5)
BHID_SFObject = iid
End Function
Public Function IID_IShellFolder() As UUID
Static iid As UUID
If (iid.Data1 = 0) Then Call DEFINE_OLEGUID(iid, &H214E6, 0, 0)
IID_IShellFolder = iid
End Function
Public Sub DEFINE_OLEGUID(Name As UUID, L As Long, w1 As Integer, w2 As Integer)
DEFINE_UUID Name, L, w1, w2, &HC0, 0, 0, 0, 0, 0, 0, &H46
End Sub
Dim psfp As IShellFolder
Dim peil As IEnumIDList
Dim pidlEnum As LongPtr
Dim pidlPar1 As LongPtr
Dim ppil As IPersistIDList
Set ppil = siParent
ppil.GetIDList pidlPar
Dim hrbh As Long: hrbh = siParent.BindToHandler(0, BHID_SFObject, IID_IShellFolder, psfp)
If (psfp Is Nothing) = False Then
psfp.EnumObjects 0, SHCONTF_FOLDERS Or SHCONTF_INCLUDEHIDDEN Or SHCONTF_INCLUDESUPERHIDDEN, peil
Else
Debug.Print "Failed to get IShellFolder for siParent; 0x" & Hex$(hrbh)
Exit Sub
End If
If (peil Is Nothing) = False Then
bFilling = True
tc1 = GetTickCount()
Do While peil.Next(1&, pidlEnum, pcl) = S_OK
SHCreateItemFromIDList ILCombine(pidlPar, pidlEnum), IID_IShellItem, siChild
Edit: You ninja'd me by a few minutes. Your new problems likely come from the other problem your code had you didn't get to yet; IEnumIDList gives relative pidls, you need to combine them with the pidl of the parent you're enumerating.
Great, it works now! :thumb:
The hidden AppData folder is now visible! :)
Replace this in TVExpandFolder:
with this:Code:siParent.BindToHandler 0&, BHID_EnumItems, IID_IEnumShellItems, pEnum
If (pEnum Is Nothing) = False Then
bFilling = True
tc1 = GetTickCount()
Do While pEnum.Next(1&, siChild, pcl) = S_OK
Other necessary code addings:Code:Dim pISF As oleexp.IShellFolder
Dim pEIDL As oleexp.IEnumIDList
Dim pidlEnum As Long
Dim lReturn As Long
Dim ppil As IPersistIDList
Set ppil = siParent
ppil.GetIDList pidlPar
lReturn = siParent.BindToHandler(0&, BHID_SFObject, IID_IShellFolder, pISF)
If (pISF Is Nothing) = False Then
lReturn = pISF.EnumObjects(0, _
SHCONTF_CHECKING_FOR_CHILDREN Or _
SHCONTF_FOLDERS Or _
SHCONTF_NONFOLDERS Or _
SHCONTF_INCLUDEHIDDEN Or _
SHCONTF_SHAREABLE Or _
SHCONTF_STORAGE Or _
SHCONTF_NAVIGATION_ENUM Or _
SHCONTF_FASTITEMS Or _
SHCONTF_INCLUDESUPERHIDDEN, _
pEIDL)
End If
If (pEIDL Is Nothing) = False Then
bFilling = True
tc1 = GetTickCount()
Do While pEIDL.Next(1&, pidlEnum, pcl) = S_OK
oleexp.SHCreateItemFromIDList ILCombine(pidlPar, pidlEnum), IID_IShellItem, siChild
Code:Private Function IID_IShellFolder() As oleexp.UUID
'{000214E6-0000-0000-C000-000000046}
Static iid As oleexp.UUID
If (iid.Data1 = 0) Then Call DEFINE_UUID(iid, &H214E6, CInt(&H0), CInt(&H0), &HC0, &H0, &H0, &H0, &H0, &H0, &H0, &H46)
IID_IShellFolder = iid
End Function
Private Function BHID_SFObject() As oleexp.UUID
'https://doxygen.reactos.org/d0/d95/shlguid_8h.html
'DEFINE_GUID (BHID_SFObject, 0x3981E224, 0xF559, 0x11D3, 0x8E, 0x3A, 0x00, 0xC0, 0x4F, 0x68, 0x37, 0xD5)
Static iid As oleexp.UUID
If (iid.Data1 = 0) Then Call DEFINE_UUID(iid, &H3981E224, CInt(&HF559), CInt(&H11D3), &H8E, &H3A, &H0, &HC0, &H4F, &H68, &H37, &HD5)
BHID_SFObject = iid
End Function
I was kidding myself, because i had the visibility options in the Windows explorer settings turned on!
Now im back where i started!
The enumeration of ShellObjects depends on the visibility settings of the Windows Explorer :sick:
But why do they offer the flag SHCONTF_INCLUDESUPERHIDDEN if it has no impact when used?
Wait I made a mistake... I didn't have ShowSuperHidden = True so the control itself was filtering them out. It's partially working for me on Server 2019 now (either SHCONTF method).
Something funky is going on though... it's showing hidden/system items everywhere except Users\Administrator on Server2019. Including Users\Default. It shows the H/S items for my logon on Win10 Enterprise LTSC; so this is a server 2019 issue I think.
I tested the new enum method with Server2019 and 2022 and i cant see the hidden AppData folder until i activate the visibility option in the explorer.
I guess i should post the problem at stackoverflow and ask the experts why SHCONTF_INCLUDESUPERHIDDEN is ignored when enumerating the content of a folder.
It's not.
It's ignored on Server 2019 (and apparently 2022) in Users\Administrator, and works everywhere else. It's showing AppData et al in every other user folder. It's showing $RECYCLE.BIN and System Volume Information in C:\... it's working. Except that single folder.
ucShellTree with new enum + ShowHidden=True & Win11 Explorer + hide hidden:
Attachment 190441
AppData is not visible for the current user but visible for the Default user in the tree!
ucShellTree with new enum + ShowHidden=True & Win11 Explorer + show hidden:
Attachment 190442
AppData is everywhere visible.
Strange!
Today i have some good news for all OCX lovers :D
After many code changes i tried to compile the control as an OCX with binary compatibility again and this time is was successfull!
I guess it was the subclassing code change. How knows...
ucShellTree can now be used as an OCX in your projects. That will make it a lot more easy to update all your projects!
There are currently only 2 known bugs:
- Item rename crashes (LabelEditRename should be disabled until fixed)
- MonitorDirChanges not work correctly
I tested the control successfully with Win7,8,10,11 & Server2008R2,2012,2016,2019,2022. Vista isnt supported due some missing shell API support.
@fafalone
How to make the changes public so other people can use or test the enhanced ucShellTree project?
My changes since v2.9.2 (ALPHA, 29 Jan 2024, fafalone):
Quote:
'v2.9.4 Mith
' - TVExpandFolder: Added a new filter method to enumerate items
' BindToHandler -> EnumObjects -> e.g. SHCONTF_INCLUDESUPERHIDDEN
'
' - replaced the thunk subclassing with Krool's subclassing
' the control crashed on all Windows Server editions because the Windows DEP protection is
' activated for all apps per default
'v2.9.3 Mith
' - Added project variable mCreateShellTreeManually.
' True = you have to call the new public function "Create_ShellTree" to create the ShellTree.
' This enables you to set up all control properties in the code before the ShellTree
' is created. Also avoids the enum of the ShellTree with the standard properties
' False = ShellTree will be created automatically after reading the usercontrol properties
'
' - Added project variable mHideLNKfileExtension.
' True = hiddes the .lnk file extension
' false = shows the .lnk file extension
'
' - Added property ShowOnlyDrives. Shows only drives when ComputerAsRoot=True and
' deactivates the expanding of drives
' - Added property HideRecycleBin. hides the recycle bin
' - Added property HideControlPanel. hides the Control Panel
' - Added property HideOneDrive. hides OneDrive
' - Added property HideNetwork. hides Network
' - Added property HideLibraries. hides Libraries
'
' - ItemClick event: now you can cancel the item checked/unchecked setting by changing the
' value of the variable fCheck (unchecked: fCheck=0, checked: fCheck=1)
'
' - Added property ShowOnlyFileCheckbox. This option hides the checkbox for all non-files
'
' - (Bug fix) overlay icons are not displayed correctly. added a new imagelist for 16x16 overlay icons
'
' - (BUG fix) m_ForceExt = STEP_AlwaysShow didnt not show all file extensions (zip, url...)
'
' - converted the latest twin basic ucShellTree Project to VB6
'v2.9.2 (ALPHA, 29 Jan 2024)
' ...see TwinBasic project
If you're going to keep updating it, I think your own thread would be best; the ctl version goes here, the OCX version in Utilities - Components along with my old ocx versions and the VBCCR ocxs Krool makes. Just note it's a fork of my project; I'm happy to see such things :)
You're definitely going a lot faster than I'll be able to update the main branch here or the newer tB branch; I've implemented some of your changes but not all and have so many things I'm trying to work on. Are you planning to update the tB version as well? If not I'll at least try to do that to make the enhancements available there.
I will share the updated ShellTree by user request. I dont want to start a new thread with a forked version.
I dont use TwinBasic, so i only update the VB6 control. Currently i have no time to upgrade my apps to TwinBasic.
Please let me know about bug fixes or new features so i can update the control.
My current tests with the enhanced VB6 ShellTree control are all successfully. Next step is to update my apps to use the OCX version.
Ok, at least attach it to a reply in this thread then, if you're still meaning to share it with others, I'd like to get a copy so I can update the tB version and eventually the VB6 version on the first post of this thread. Or you can PM it to me if you didn't want such broad exposure. Or not, your fork, up to you.
ucShellTree v2.9.4 download: Attachment 190452
Included files:
ucShellTree.ctl
ucShellTree.ctx
ucShelltree.bas
To use it as an OCX it would be better to convert this project variables to public control properties:
Code:Private Const mNeverExpandZip As Boolean = True 'Never expand a zip under any circumstances.
Private Const mHideLNKfileExtension As Boolean = True
Private Const mCreateShellTreeManually As Boolean = True
I found another problem while testing the control:
Drive letters linked to network shares or local folders are not displayed in the ShellTree.
For example, i mapped the network share "\\nassrv\data" with Z: but i cant see the drive Z anywhere in the control.
Do you have any ideas how to show them in the tree?
I found the problem:
The new enum method doesnt include these kind of drives:
Switching back to the old method fixed the problem!Code:lReturn = pISF.EnumObjects(0, _
SHCONTF_CHECKING_FOR_CHILDREN Or _
SHCONTF_FOLDERS Or _
SHCONTF_NONFOLDERS Or _
SHCONTF_INCLUDEHIDDEN Or _
SHCONTF_SHAREABLE Or _
SHCONTF_STORAGE Or _
SHCONTF_NAVIGATION_ENUM Or _
SHCONTF_INCLUDESUPERHIDDEN, _
pEIDL)
There is always a drawback when fixing a problem!
In this case i wanted to show all hidden items but in the end the AppData folder still isnt visible and now the linked drives are not visible too...:sick:
Don't include all those flags. Try
SHCONTF_FOLDERS Or _
SHCONTF_NONFOLDERS Or _
SHCONTF_INCLUDEHIDDEN Or _
SHCONTF_INCLUDESUPERHIDDEN,
Mine have always been only under ThisPC. Only my external USB drives show up as children of the Desktop.
You said they were showing with the original method; is it different with that?
No, its not different with the original method. I was just wondering why not all drives are shown at the Desktop branch. I guess at Desktop you only see drives that are available for all users and at "This PC" they also show drives that are only available for the current user.
Win 10 german enum comparison:
Attachment 190460
They look the same, the old enum in the middle and the new enum at the right.
I just saw that the overlay icon for linked folders is gone. See left vs middle&right.
And the folder "C:\Programme" aka "C:\Program Files" is displayed twice.
One can be expanded and the other one is a link and cannot be expanded.
I checked this with the original v2.7, same result, displayed twice.
I found the problem: you removed "Or ILC_MASK" at InitImageLists at your TB project and i copied your code!
Add the flag again to see overlay icons:
Private Sub InitImageLists()
himlTV = ImageList_Create(mIconSize, mIconSize, ILC_COLOR32 Or ILC_MASK Or ILC_HIGHQUALITYSCALE, 1, 1)
...
End Sub
Just a heads up I found a bug where if you have dpi awareness enabled, IconSize will continuously increase on subsequent runs from the IDE (including reloads in designer). Need to remove mIconSize = mIconSize * m_ScaleX in pvCreate, cxy = cxy * m_ScaleX in Property Let IconSize, then change all the other uses of it (besides prop read/write/init) to scale there, e.g. TVEntries(1).nIcon = TranslateIcon(lpIcon, siFav, pidlParF, pidlFav, mIconSize * m_ScaleX, mIconSize * m_ScaleY, pidlChF)
Edit: Re: ILC_MASK, must be a versioning thing I added that in after finding out the overlays were no longer showing up after I added IconSize.
Changes done:
Looks good at Win11 DPI 175%:Quote:
' - (Bug fix) if you have dpi awareness enabled, IconSize will continuously increase on subsequent runs
'
' - (Bug fix) drives linked to network shares are not displayed at the branch "This PC"
'
' - (Bug fix) overlay icons are not displayed because of the missing flag ILC_MASK
' in the function InitImageLists
Attachment 190462
[deleted] due to misleading info.
I think there should be a way, such as using a notepad. Or the setting can directly replace these changed codes with the original huge project.
Then which of your new version functions have been merged and which have not?
We need a tool for such management.
Perhaps it is best to use github in this way.
We have a new feature that we can request to be incorporated. If you are not afraid of merging, you can use it as a virtual mirror. It doesn't actually take up more hard drive space, it's just a configuration.
For example, translate the twinbasic IDE into the languages of different countries. We just need to write a translation settings file to replace the text in the web page with other languages. This configuration only needs 20kb.
Suppose, suppose we add a version flag to each control or piece of code. At top of code file (*.frm, CLS, *.ctl) Is 64-bit supported? [supportx64=1] [codeVersion=2.2] On the vbforums forum, it is also difficult to make it an automatic update version. And the site may one day go out of business or the hard drive is damaged.So it would be better to release all the source code to a github open source project. What is uploaded to VB fourms is just a copy of the old version. We also need a VB6 version of the github automatic version control system plugin. Just like the software installed on our computers is automatically upgraded. A function or a module can be versioned. Some code has been changed, and it can be replaced directly from the original version to the last five versions. However, some modules can only support continuous upgrade from a certain version.
Mith posted his version with those changes in post #210.
They're also available in the twinBASIC version of ucShellTree, which is several versions ahead of the VB6 version here.
If you want to talk about translating tB, do it in the tB forum, tB GitHub, or tB Discord. Not in my ucShellTree thread.