By default, winvile is _not_ built with OLE Automation enabled, but this command adds that feature:
    nmake -f makefile.wnt CFG=winvile OPT=ole-auto
  Or, if an embedded perl support is desired, use this syntax:
    nmake -f makefile.wnt CFG=winvile-with-perl OPT=ole-auto
  OLE Automation support is not available until the Windows registry has been updated with various configuration information. The simplest method of registration is to:
        winvile -Or
    The second step registers winvile as an OLE automation server that will be launched (by a client) with _no_ command line options, which implies these server attributes:
There are, however, a number of command line options that can be specified during registration and which subsequently affect the launched winvile server.
The complete registration syntax is:
    winvile -Or [-geometry <cols>x<rows>] [-multiple] [-invisible]
                [{-font|-fn} <font_spec>]
  where:
| -geometry <cols>x<rows> | specifies the editor's window geometry. | 
| -invisible | launched server(s) are invisible and must be made visible via the application's Visible property. | 
| -multiple | each client creates a new, unique server instance. | 
| -font <font_spec> | specifies the editor's font | 
where:
    <font_spec>  :== [<face>,]<size>[,<style>]
    <face>       :== font-name
    <size>       :== point size (as an integer)
    <style>      :== { bold | italic | bold-italic }
  | Note 1: | if <style> is unspecified, "normal" is assumed. | 
| Note 2: | if <face> contains a comma escape it with '\'. | 
| Note 3: | if <face> is omitted, the current font is modified. | 
| Note 4: | if <face> contains spaces, delimit <font_spec> as appropriate for the current shell/desktop environment. | 
| Note 5: | <face> must be fixed pitch. To obtain a list of all fixed pitch fonts on the current win32 host, invoke winvile and browse the "Font" dialog box accessible from the System menu (accelerator key is ALT+<space bar>+F). | 
    Example:       -font 'Letter Gothic,8'
    Example:       -fn r_ansi,8,bold
  Note that it's generally not necessary to specify the font or geometry when registering winvile because those parameters may be set in the vile startup file (vile.rc). See the vile help topic "Win32 specifics" for further information.
Perl Access
        use Win32::OLE;
        $vile = new Win32::OLE 'Winvile.Application';
        $vile->VileKeys(":show-bindings\n");
        $vile->{Visible} = 1;           # may not be necessary
        print "sleeping for 3 seconds\n";
        sleep(3);
        $vile->VileKeys(":buffer [unnamed]\n");
        $vile->VileKeys(":r c:/config.sys\n");
        sleep(3);
        print "killing vile\n";
        $vile->Quit();
        exit
  
        Private VileObj As Winvile.Application
  
        Private Sub Form_Load()
        Set VileObj = New Winvile.Application
        VileObj.Visible = True           ' may not be necessary
        VileObj.VileKeys (":help" + vbLf)
        End Sub
  
        Private Sub Quit_Click()
        VileObj.Quit                     ' Kill the server (winvile)
        End
        End Sub
  
[ Note: Ed Henderson discovered this novel use of automation and wrote the original version of wvwrap.exe . Thanks, Ed! ]
It's possible to modify the Windows registry such that any arbitrary utility appears on the Windows Explorer right mouse popup menu. To do so, use regedit to create the following entry in the registry:
        HKEY_CLASSES_ROOT\*\shell\<utility_name>\command
  Example:
        HKEY_CLASSES_ROOT\*\shell\winvile\command
  Next, give the "command" key the following (Default) value:
        <utility_name> "%1"
  An actual example:
        HKEY_CLASSES_ROOT\*\shell\winvile\command\winvile "%1"
  Once this registry entry is installed, then anytime the right mouse button is clicked on a file in Windows Explorer, "winvile" appears as a selection at the top of the popup menu. Choosing winvile from this menu launches the editor, which then opens the selected file. So far, so good. However, when multiple files are selected and winvile is launched via a right mouse click, Windows Explorer opens one instance of the editor per selected file. Most vile-aholics will find this behavior rather repugnant. However, if winvile is configured as a single server instance (the default), a workaround exists. Read on.
When the Ole Automation version of winvile is built as described above, a utility called wvwrap.exe is also created. Copy wvwrap to a directory in your PATH and create the following registry entry:
        HKEY_CLASSES_ROOT\*\shell\wvwrap\command\wvwrap "%1"
  If using Windows XP, it's necessary to specify the full path to wvwrap, as shown here:
        HKEY_CLASSES_ROOT\*\shell\wvwrap\command\<full_path_to>wvwrap.exe "%1"
  Now, as a test, select multiple files within Window Explorers, right click the mouse, and launch wvwrap. Notice that all files are read into a single instance of winvile, one buffer per file.
| Application | — | [out] Returns the application object. | 
| ForegroundWindow() | — | Makes the editor the foreground window. Note that Windows 2000 and XP essentially emasculated this method. See MainHwnd() for an alternative approach. | 
| FullName | — | [out] Returns the path of the application. | 
| InsertMode | — | [out] True if editor window with keyboard focus is in insert mode. | 
| IsMinimized | — | [out] True if editor minimized. | 
| MainHwnd | — | [out] Returns the editor's main window handle. Useful if the client wishes to, say, call SetForegroundWindow() on behalf of the editor. | 
| Minimize() | — | Minimizes the editor. | 
| Name() | — | [out] Returns the name of the application. | 
| Parent() | — | Returns the parent of the application object. | 
| Quit() | — | Exits the editor. | 
| Restore() | — | Restores the editor's window. | 
| VileKeys([in] keys) | — | Sends keystrokes to the editor. Note that this method is implemented by using PostMessage() to send a WM_CHAR message for _each_ character in the "keys" string. In other words, this is not an efficient method and should not be used to create large files. | 
| Visible | — | [in, out] Sets or returns the editor's visibility. | 
| WindowRedirect([in] hwnd) | — | Specifies a window handle to which user-specified
        keystrokes are redirected. Redirected keystrokes are
        specified via winvile's "redirect-keys" mode. Refer to the
        file visvile.doc for a detailed
        discussion of this method and its associated mode. To disable redirection once enabled, pass this method a NULL window handle. | 
Note: ForegroundWindow(), Minimize(), and Restore() implicitly force an Invisible server to the Visible state.
To unregister winvile as an OLE automation server, execute this command:
    winvile -Ou