ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
ShellBrowser.TShellBrowser.GetUIObject

Wrapper for IShellFolder.GetUIObjectOf() method which retrieves a COM object for current shell object(s).

Syntax
Pascal
function GetUIObject(const pInterfaceID: TGUID): IUnknown;
Parameters 
Description 
const pInterfaceID: TGUID 
Interface identifier (IID) of the interface that should be returned, e.g. IID_IDropTarget. 

Returns the requested COM Object for the current shell object(s).

Wrapper for the Windows shell API IShellFolder.GetUIObjectOf() which will be rarely used directly by developers. For a list of valid interface identifiers that can be passed please visit MSDN. The function will use the contents of the MultiObjects property if it is not empty. The caller should clear on MultiObjects after calling this method.

Exceptions 
Description 
If an error occurred when querying the context menu from the system. 
EInvalidOperation 
If there is no active object. 

To get the IDropTarget interface for drive C:, you can use the following code:

var DropTarget: IDropTarget;
begin
  ShellBrowser.Folder := 'C:';
  DropTarget := ShellBrowser.GetUIObject(IID_IDropTarget) as IDropTarget;
  ...