Provides an interface that allows hosted Shell extensions and other components to prevent their host process from closing prematurely. The host process is typically Windows Explorer or Windows Internet Explorer, but this function can also be used by other applications.
void SHSetInstanceExplorer( IUnknown *punk );
A pointer to a free-threaded IUnknown. Components can use this interface (through SHGetInstanceExplorer) to prevent the host process from terminating. This value can be NULL, in which case the process reference is no longer made available to components.
This function does not return a value.
Windows Explorer and Internet Explorer can use SHSetInstanceExplorer to allow components such as Shell extensions to extend the lifetime of the process. Other applications can also use SHSetInstanceExplorer to allow for the same capability. For instance, the browser message loop and the proxy desktop use SHSetInstanceExplorer to let other threads extend their lifetime.
Applications other than Windows Explorer and Internet Explorer that call this function might encounter compatibility problems because some components use SHGetInstanceExplorer to detect whether they are being hosted from within Windows Explorer or Internet Explorer.
The interface pointer passed to SHSetInstanceExplorer must reference a free-threaded object.
Each time a component calls SHGetInstanceExplorer, the system calls the AddRef method before returning the interface pointer to the calling component. The component then calls the IUnknown::Release method when processing is complete. The process that calls SHSetInstanceExplorer must not terminate while the reference count of the provided interface pointer is nonzero.
For further information on how components use the process references, see SHGetInstanceExplorer.
|Windows version||Windows XP [desktop apps only] Windows Server 2003 [desktop apps only]|
|Header||shlobj_core.h (include Shlobj.h)|
|DLL||Shell32.dll (version 5.0 or later)|