delphi - Adding custom items to an TShellTreeView -


Anyone know how to modify ShellCtrls.pas? Actually I want to add some items to the top of the Explorer tree

For example:.

  -myitem -miitemtoo -mycomputer -c: -d:  

or may be modified view of this Vrihddh tree:

But I think ShellCtrls is the main file to be modified.

I do not think you need to modify sources. Share TShellTreeView is descended of TCustomTreeView, so if you can add items as a TreeView item.

The code below is not sorted out or tested out, but it may be that you get started. . It is inserted at the top of an item with a display name with the path as the path and performance as the name qualified ShellTreeView execution

  shlobj ActiveX, use shellapi; Function InsertToSTV (STV: TShellTreeView; Pos: Integer; Path, DisplayName: String): Boolean; Var Shellfolder Interface, NodeShellfolder: ISIL Folder; Item Idiist: PITMIDLIS; Chairspersons, Attributes: Ulong; WPath: PWideChar; Node: TTRI node; File information: TSHFileInfo; Start the result: = False; If (SHGetDesktopFolder (ShellFolderInterface = NOERROR) then start wPath: = StringToOleStr (path); If wPath & lt; & Gt; Zero tries to ShellFolderInterface.ParseDisplayName (0, zero, wPath, CharsParsed, ItemIDList, properties) = NO_ERROR so ShellFolderInterface.BindToObject (ItemIDList, zero, IID_IShellFolder, NodeShellFolder); Node: = STV.Items.Insert (STV.Items [Pos], DisplayName); Node Data: = Tichelle Folder. Create (Zero, Item Idiildist, Nodeshhelf Folder); If STV.UseShellImages and Assigned (STV.Images) start SHGetFileInfo (PChar (ItemIDList), 0, FileInfo, sizeof (FileInfo), SHGFI_PIDL or SHGFI_SYSICONINDEX); Node IJEndx: = File InfoIiCon; SHGetFileInfo (PChar (ItemIDList), 0, FileInfo, sizeof (FileInfo), SHGFI_PIDL or SHGFI_SYSICONINDEX or SHGFI_OPENICON); Node Selected index: = file infoIiCon; End; Finally SysFreeString (wPath); End; End; End; Process TForm1.Button1Click (Sender: Tubbed); Starting InsertToSTV (ShellTreeView1, 0, ExtractFilePath (Application.ExeName), ExtractFileName (Application.ExeName)); End;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -