home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vile-src.zip / vile-8.1 / doc / oleauto.doc < prev    next >
Text File  |  1998-09-03  |  5KB  |  160 lines

  1.                            OLE Automation Support
  2.                            ======================
  3. Winvile can be built and configured to execute as an OLE Automation server.
  4. The following steps are required:
  5.  
  6.    1) build a version of winvile that supports OLE,
  7.    2) configure winvile as a server, and
  8.    3) use an OLE automation client to invoke and manipulate winvile.
  9.  
  10.  
  11. Build Syntax
  12. ============
  13. By default, winvile is _not_ built with OLE Automation enabled, but this
  14. command adds that feature:
  15.  
  16.     nmake -f makefile.wnt CFG=winvile OPT=ole-auto
  17.  
  18. Or, if an embedded perl support is desired, use this syntax:
  19.  
  20.     nmake -f makefile.wnt CFG=winvile-with-perl OPT=ole-auto
  21.  
  22.  
  23. Minimal Configuration
  24. =====================
  25. OLE Automation support is not available until the Windows registry has been
  26. updated with various configuration information.  The simplest method of
  27. registration is to:
  28.  
  29.     a) copy winvile.exe to some directory in your PATH, and then
  30.     b) execute this command:
  31.  
  32.             winvile -Or
  33.  
  34. Step b) registers winvile as an OLE automation server that will be launched
  35. (by a client) with _no_ command line options, which implies these server
  36. attributes:
  37.  
  38.     - editor geometry is 24 rows by 80 columns
  39.     - default font is "system fixed", 12-point (crayola-sized :-) )
  40.     - editor visible
  41.     - a single server instance (i.e., no matter how many clients create a
  42.       winvile server object, there will be at most one server instance).
  43.  
  44. There are, however, a number of command line options that can be specified
  45. during registration and which subsequently affect the launched winvile
  46. server.
  47.  
  48.  
  49. Registration Options
  50. ====================
  51. The complete registration syntax is:
  52.  
  53.     winvile -Or [-geometry <cols>x<rows>] [-multiple] [-invisible]
  54.                 [{-font|-fn} <font_spec>]
  55.                 
  56.  
  57. where:
  58.  
  59.     -geometry <cols>x<rows>   specifies the editor's window geometry.
  60.     -invisible                launched server(s) are invisible and must be
  61.                                   made visible via the application's Visible
  62.                                   property.
  63.     -multiple                 each client creates a new, unique server
  64.                                   instance.
  65.     -font <font_spec>         specifies the editor's font
  66.  
  67. where:
  68.               
  69.     <font_spec>  :== [<face>,]<size>[,<style>]  
  70.     <face>       :== font-name  
  71.     <size>       :== point size (as an integer)
  72.     <style>      :== { bold | italic | bold-italic }
  73.   
  74.     Note 1:  if <style> is unspecified, "normal" is assumed.
  75.     Note 2:  if <face> contains a comma escape it with '\'.
  76.     Note 3:  if <face> is omitted, the current font is modified.
  77.     Note 4:  if <face> contains spaces, delimit <font_spec> as appropriate
  78.              for the current shell/desktop environment.
  79.     Note 5:  <face> must be fixed pitch.  To obtain a list of all fixed
  80.              pitch fonts on the current win32 host, invoke winvile and
  81.              browse the "Font" dialog box accessible from the System menu
  82.              (accelerator key is ALT+<space bar>+F).
  83.  
  84.     Example:       -font 'Letter Gothic,8'
  85.     Example:       -fn r_ansi,8,bold 
  86.   
  87.  
  88. Example Automation Client Access
  89. ================================
  90. Perl Access
  91.     use Win32::OLE;
  92.     $vile = new Win32::OLE 'Winvile.Application';
  93.     $vile->VileKeys(":show-bindings\n");
  94.     $vile->{Visible} = 1;           # may not be necessary
  95.     print "sleeping for 3 seconds\n";
  96.     sleep(3);
  97.     $vile->VileKeys(":buffer [unnamed]\n");
  98.     $vile->VileKeys(":r c:/config.sys\n");
  99.     sleep(3);
  100.     print "killing vile\n";
  101.     $vile->Quit();
  102.     exit
  103.  
  104. VB Access
  105.     Private VileObj As Winvile.Application
  106.  
  107.     Private Sub Form_Load()
  108.     Set VileObj = New Winvile.Application
  109.     VileObj.Visible = True           ' may not be necessary
  110.     VileObj.VileKeys (":help" + vbLf)
  111.     End Sub
  112.  
  113.     Private Sub Quit_Click()
  114.     VileObj.Quit                     ' Kill the server (winvile)
  115.     End
  116.     End Sub
  117.  
  118.  
  119. Server Properties And Methods
  120. =============================
  121. Application         -- [out] Returns the application object.
  122.  
  123. ForegroundWindow()  -- Makes the editor the foreground window.  Note that NT5
  124.                        has redefined the behavior of SetForegroundWindow().
  125.  
  126. FullName            -- [out] Returns the path of the application.
  127.  
  128. InsertMode          -- [out] True if editor window with keyboard focus is
  129.                        in insert mode.
  130.  
  131. IsMinimized         -- [out] True if editor minimized.
  132.  
  133. Minimize()          -- Minimizes the editor.
  134.  
  135. Name()              -- [out] Returns the name of the application.
  136.  
  137. Parent()            -- Returns the parent of the application object.
  138.  
  139. Quit()              -- Exits the editor.
  140.  
  141. Restore()           -- Restores the editor's window.
  142.  
  143. VileKeys([in] keys) -- Sends keystrokes to the editor.  Note that this method
  144.                        is implemented by using PostMessage() to send a
  145.                        WM_CHAR message for _each_ character in the "keys"
  146.                        string.  In other words, this is not an efficient
  147.                        method and should not be used to create large files.
  148.  
  149. Visible             -- [in, out] Sets or returns the editor's visibility.
  150.  
  151. Note:  ForegroundWindow(), Minimize(), and Restore() implicitly force an
  152.        Invisible server to the Visible state.
  153.  
  154.  
  155. Unregistering The Server
  156. ========================
  157. To unregister winvile as an OLE automation server, execute this command:
  158.  
  159.     winvile -Ou
  160.