function CloseComponent


function Closecomponent(Component : PChar) : boolean;

Exported by: SharpApi.dll
Declared in: svn\common\libraries\SharpApi\SharpApi.pas


Parameters

  • Component: PChar

Name of the component or window class name of the windows which are going to be closed.
If this parameter is not a window class name then it can have the following values: sharpdesk, sharpcore, sharpbar, sharpconsole, sharpmenu


Description

The Closecomponent function can be used to either close all windows by their window class name or to close sharpe components. This functions will find all windows/components matching the component parameter, so it will close all those windows and not only one or the first window.
Closing the window is working in 3 steps:

  • WM_SHARPTERMINATE will be send to the target windows. This message is ignored by any non SharpE components.
  • WM_CLOSE is send by Postmessage to the window.
  • WM_QUIT is posted as a thread message to the window (Postthreadmessage)


Examples

  CloseComponent('sharpbar');
  CloseComponent('CabinetWClass'); // all explorer windows