RE: Vim OLE and C# - Solution

2007-04-18 Thread David Fishburn
 

 -Original Message-
 From: David Fishburn [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 12, 2007 1:12 PM
 To: vim@vim.org
 Subject: Vim OLE and C#
 
 
 I have the following VB code:
 
 Dim Vim As Object
 Set Vim = CreateObject(Vim.Application)
 Vim.SendKeys ESC:e 
 
 I want to do the samething in C# (of which my skills are 
 quite weak).  I have the following:
   object Vim;
   Vim =
 Activator.CreateInstance(Type.GetTypeFromProgID(Vim.Application));
   Vim.SendKeys(ESC:e );
 
 Most of that was grabbed from Google.
 
 Compiler error:
 Error 3   'object' does not contain a definition for 
 'SendKeys'...
 
 I am assuming I must strongly type the object, so I tried:
   Vim.Application Vim;
 
 Error 3   The type or namespace name 'Vim' could not be 
 found (are you
 missing a using directive or an assembly reference?)  ...
 
 
 Any suggestions?
 
 Once I get this working I will get it added under this 
 section in the Vim
 help:
 :h ole-activation

Bram, I managed to get this working.

If you could update ole-activation section of the help, it might help
others.


Add a reference to VIM in your project. You need to select VIM Ole
Interface from the COM tab.

Add using Vim;  to the top of the file.
Then the following code works.
   Vim.Vim vimobj = new Vim.Vim();
vimobj.SendKeys(:enew\n);


Dave



Vim OLE and C#

2007-04-12 Thread David Fishburn

I have the following VB code:

Dim Vim As Object
Set Vim = CreateObject(Vim.Application)
Vim.SendKeys ESC:e 

I want to do the samething in C# (of which my skills are quite weak).  I
have the following:
object Vim;
Vim =
Activator.CreateInstance(Type.GetTypeFromProgID(Vim.Application));
Vim.SendKeys(ESC:e );

Most of that was grabbed from Google.

Compiler error:
Error   3   'object' does not contain a definition for 'SendKeys'   ...

I am assuming I must strongly type the object, so I tried:
Vim.Application Vim;

Error   3   The type or namespace name 'Vim' could not be found (are you
missing a using directive or an assembly reference?)...


Any suggestions?

Once I get this working I will get it added under this section in the Vim
help:
:h ole-activation

Thanks,
Dave