Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Creating a Link in the Left Pane of the File Explorer - like OneDrive or DropBox

0.00/5 (No votes)
22 Aug 2016 1  
Creating a link in the left pane of the file Explorer - like OneDrive or DropBox

Introduction

I had a special requirement of adding a link in the left pane of the file explorer as one of the roots in the tree structure (like OneDrive or DropBox), which will opens that particular folder. I was roaming around the web to find some solution for this but didn't find any useful articles. This lead me to write this article after I completed the task through registry operations. I would like to share these experience with you.

Ways of Implementation

To implement this, you need a reserved GUID (which represents your entry), you can create your own GUID or it can be downloaded from here. Once you have the GUID (let it be "g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a" for this example), then you can follow any of the following steps to achieve this:

  • Editing required registry entries manually
  • Creating and executing registry file

Editing Required Registry Entries Manually

You need to do a series of registry operations in this method.

  1. Open Registry HKEY_CURRENT_USER then move on to KEY_CURRENT_USER\ Software\Classes\CLSID. Then, add a Key that is your guid.

  2. Select that key after creating them. Then you will be at [KEY_CURRENT_USER\Software\Classes\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]. Add the following under this specific key.

    1. Select the Default string item in the right pane and set your App_Name as Data (say MyApp).

    2. A DWORD with Name "System.IsPinnedToNamespaceTree" and having a value of 1.

    3. Create another DWORD with name "SortOrderIndex" with a value 42.

    4. Create another Key named "DefaultIcon" which is to set the Icon of the shortcut in the left pane. And you have to specify the IconPath there in the data section of the default value.

    5. Next, we have to create another Key field named "InProcServer32" (not under the DefaultIcon) with specific data. "%SYSTEMROOT%\system32\shell32.dll" in the default value.

    6. The next Key that you have to create is "Instance", need not set any default value for this. But you have to create a string value inside this Instance which is calledCLSID that should have a value of{0E5AAE11-A475-4c5b-AB00-C66DE400274E} .

    7. Now, we need to add a sub key named "InitPropertyBag" under the Instance (keep in mind your current location is HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{722f82b1-fd88-47b9-8af3-1d9ff79ebc76}\Instance). No need for any default value for this particular key.

    8. Move on to the new Key to create some values:

      1. Create an expandable string value (REG_EXPAND_SZ) "TargetFolderPath" which represents the location of the target folder, so you have to specify the local path here as the data for this field (let it be "C:\Users\Suji\MyApp").

      2. Create a DWORD "Attributes" with a Hex value of 11.

    9. You need to create the same keys, sub keys and values under HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\CLSID for the 64 bit systems.

  3. First part is over. Now move on to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace. Create a key there for our GUID and the default value will be "MyApp".

  4. Move on to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel and create a DWORD with GUID as name and 1 as data.

  5. The process is completed. Now you can close the Registry editor, refresh the Explorer to see the Icon.

Creating and Executing Registry File

Copy the following code to a text file and save them with .reg extension, then run that file with administrator privilege.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]
@="MyApp"
"System.IsPinnedToNamespaceTree"=dword:00000001
"SortOrderIndex"=dword:00000042

[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\
{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\InProcServer32]
@=hex(2):25,00,53,00,59,00,53,00,54,00,45,00,4D,00,52,00,4F,00,4F,00,54,00,\
25,00,5C,00,73,00,79,00,73,00,74,00,65,00,6D,00,33,00,32,00,5C,00,73,00,68,\
00,65,00,6C,00,6C,00,33,00,32,00,2E,00,64,00,6C,00,6C,00,00,00

[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\ShellFolder]
"FolderValueFlags"=dword:00000028
"Attributes"=dword:f080004d

[HKEY_CURRENT_USER\Software\Classes\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]
@="MyApp"
"System.IsPinnedToNamespaceTree"=dword:00000001
"SortOrderIndex"=dword:00000042

[HKEY_CURRENT_USER\Software\Classes\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\InProcServer32]
@=hex(2):25,00,53,00,59,00,53,00,54,00,45,00,4D,00,52,00,4F,00,4F,00,54,00,\
25,00,5C,00,73,00,79,00,73,00,74,00,65,00,6D,00,33,00,32,00,5C,00,73,00,68,\
00,65,00,6C,00,6C,00,33,00,32,00,2E,00,64,00,6C,00,6C,00,00,00

[HKEY_CURRENT_USER\Software\Classes\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\ShellFolder]
"FolderValueFlags"=dword:00000028
"Attributes"=dword:f080004d

[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\DefaultIcon]
@="C:\\Program Files (x86)\\Google\\Drive\\googledrivesync.exe,0"

[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\Instance]
"CLSID"="{0E5AAE11-A475-4c5b-AB00-C66DE400274E}"

[HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID\
{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\Instance\InitPropertyBag]
"Attributes"=dword:00000011
"TargetFolderPath"="C:\\Users\\Suji\\MyApp"

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
"{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}"=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\
{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]
@="MyApp"

[HKEY_CURRENT_USER\Software\Classes\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\DefaultIcon]
@="C:\Windows\System32\hwrreg.exe,0"

[HKEY_CURRENT_USER\Software\Classes\CLSID\{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\Instance]
"CLSID"="{0E5AAE11-A475-4c5b-AB00-C66DE400274E}"

[HKEY_CURRENT_USER\Software\Classes\CLSID\
{g16fa3ab-70d2-4fc7-9c99-fcbf05467f3a}\Instance\InitPropertyBag]
"Attributes"=dword:00000011
"TargetFolderPath"="C:\\Users\\Suji\\MyApp"

Points of Interest

You can implement the same through C# code. I will update the article with the code and sample solution for that.

History

This is the primary version.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here