As the the title says. Manage your known folders by enabling IKnownFolderManager Interface.
I have not yet tried all methodes but it seems really useful and powerfull.
For example setting up your own "Control Panel" for management of all the known folders.
And for example use GetFolder method to retrieve indvidual IKnownFolder and configure them as well.
Also I have named the function in "MS Shellish way"
Enough with explaining
Go ahead and play around but BE AWARE!! ALL CHANGES ARE PERMANENT!!
Depending on how old your system is you can use one of these two API's for converting the "bracket guid strings" to GUID Types.Code:'This will remove EVERYTHING in your Library folder and add in this case "D:\" drive Private Sub Command4_Click() Dim pIKFM As IKnownFolderManager Dim pIKF As IKnownFolder Dim lpGUID As UUID ShGetIKnownFolderManager pIKFM 'Libraries Main Folder IIDFromString StrPtr("{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"), lpGUID pIKFM.GetFolder lpGUID, pIKF If Not pIKF Is Nothing Then pIKF.SetPath KF_FLAG_DEFAULT, "D:\" End If End Sub Public Function ShGetIKnownFolderManager(pIKFM As IKnownFolderManager) As Long Static CLSID_KnownFolderManager As GUID Dim hr As Long hr = GuidFromStringW(StrPtr("{4df0c730-df9d-4ae3-9153-aa6b82e9795a}"), CLSID_KnownFolderManager) hr = CoCreateInstance(CLSID_KnownFolderManager, 0, CLSCTX_INPROC_SERVER, IID_IKnownFolderManager, pIKFM) If hr = S_OK Then ShGetIKnownFolderManager = S_OK Else ShGetIKnownFolderManager = hr End If End Function
I use the Unicode version (W).
Here is the MSDN documentation for this interface.Code:Public Declare Function GuidFromStringA Lib "shell32.dll" Alias "#703" (ByVal pszGUID As String, ByRef pguid As GUID) As Long Public Declare Function GuidFromStringW Lib "shell32.dll" Alias "#704" (ByVal pszGUID As Long, ByRef pguid As GUID) As Long
https://learn.microsoft.com/en-us/wi...nfoldermanager
Cheers
/Kent![]()







Reply With Quote