# ViewerControl

The ViewerControl function allows to query and control the state of the internal viewer.

    int WINAPI ViewerControl(
      int Command,
      void *Param
    );

### Parameters

Command
Control command type. Can be one of the following (VIEWER_CONTROL_COMMANDS enum):

Command | Description
--- | ---
VCTL_GETINFO | Gets viewer information. Param points to a ViewerInfo structure. This command always returns `TRUE`.
VCTL_QUIT | Close the viewer. Param must be `NULL`. This command always returns `TRUE`.
VCTL_REDRAW | Redraws the viewer window. Param must be `NULL`. This command always returns `TRUE`.
VCTL_SETKEYBAR | Allows to control key bar titles in the viewer: Param = NULL - restores the previous value Param = -1 - redraws the key bar Param = pointer to a KeyBarTitles structure. This command always returns `TRUE`.
VCTL_SELECT | Controls selection. Param points to a ViewerSelect structure. If Param = NULL, selection will be reset. If the command succeeds `TRUE` is returned.
VCTL_SETMODE | Change viewer mode. Param points to a ViewerSetMode structure. If the command succeeds `TRUE` is returned.
VCTL_SETPOSITION | Sets position in file. Param points to an ViewerSetPosition structure. If the command succeeds `TRUE` is returned.

Param
Read the description of the Command parameter for concrete information.

### Return Value

Read the description of the Command parameter for concrete information.

### Remark

In FAR 1.70 build 1579 and newer VCTL_QUIT when send from an information or a qiuck view panel does not close the viewer.
See also:
Service functions, ViewerInfo, ViewerSetPosition, ViewerSelect