I have a piece of code to open an instance of a COM object and perform different tasks. My problem is that if the application that I open with COM is already running then I reuse that instance. I would always like to have new instance and work with that and finally close. Anyway to do that?
Type t = System.Type.GetTypeFromProgID("QlikTech.QlikView");
QlikView.Application app = (QlikView.Application)Activator.CreateInstance(t);
app.OpenDocEx("c:\\test.qvw",1,false,null,null,null,true);
String script = app.ActiveDocument().GetScript();
StreamWriter outfile = new StreamWriter("c:\\test.qvw.txt");
outfile.Write(script);
outfile.Close();
app.Quit();