I am creating C# application that uses OCX component. I have this component from manufacturer of some kind of printer. During installation of their files, foo.ocx was added to my C:\Windows\System32.
The only thing I had to do is add reference in Solution Explorer, and point that library in COM tab. Then I took interface:
[Guid("XXX")]
[CoClass(typeof(FooClass))]
public interface Foo : IFoo { }
and I created instance of COM interface:
class Program
{
static void Main(string[] args)
{
var foo = new Foo();
}
}
and everything works OK. Am I doing this right?
The second thing and more important to me is, that I am not sure how to deploy this. Referenced file in solution explorer has properties: Embed Interop Type: True, Isolated: False. This will lead to only 1 exe file in build directory. I would like to use my application on other machine, so I have to do something, but I am not sure, what. I tried to change properties of that reference, including copy local, but I suspect I have to install this ocx file on other machine. Should I use regsvr32 or regasm? Shoud I register this ocx file or something else?