I don't think you need to modify the sources. The stock TShellTreeView is a descendant of TCustomTreeView, hence you can add items as in a TreeView.
The below code is not throughly thought out or tested, but it might get you started. It inserts at the top of the ShellTreeView an item with display name as the executable name and with path as the path to the executable.
uses
shlobj, activex, shellapi;
function InsertToSTV(STV: TShellTreeView; Pos: Integer;
Path, DisplayName: string): Boolean;
var
ShellFolderInterface, NodeShellFolder: IShellFolder;
ItemIDList: PItemIDList;
CharsParsed, Attributes: ULONG;
wPath: PWideChar;
Node: TTreeNode;
FileInfo: TSHFileInfo;
begin
Result:= False;
if (SHGetDesktopFolder(ShellFolderInterface) = NOERROR) then begin
wPath:= StringToOleStr(Path);
if wPath <> nil then
try
if ShellFolderInterface.ParseDisplayName(0, nil, wPath, CharsParsed,
ItemIDList, Attributes) = NO_ERROR then
ShellFolderInterface.BindToObject(ItemIDList, nil, IID_IShellFolder,
NodeShellFolder);
Node := STV.Items.Insert(STV.Items[Pos], DisplayName);
Node.Data := TShellFolder.Create(nil, ItemIDList, NodeShellFolder);
if STV.UseShellImages and not Assigned(STV.Images) then begin
SHGetFileInfo(PChar(ItemIDList), 0,
FileInfo,
SizeOf(FileInfo),
SHGFI_PIDL or SHGFI_SYSICONINDEX);
Node.ImageIndex := FileInfo.iIcon;
SHGetFileInfo(PChar(ItemIDList), 0,
FileInfo,
SizeOf(FileInfo),
SHGFI_PIDL or SHGFI_SYSICONINDEX or SHGFI_OPENICON);
Node.SelectedIndex := FileInfo.iIcon;
end;
finally
SysFreeString(wPath);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
InsertToSTV(ShellTreeView1,
0,
ExtractFilePath(Application.ExeName),
ExtractFileName(Application.ExeName));
end;