views:

334

answers:

1

I'm using CreateObject(progId) in Vb to create a pdfDOcument. But the problem is that after i'm done and closing the document and release, How can i shutdown the process?

How can i reference the process and know if it was already open by the user before i Created the object? and how can i kill the process if the process was not running before i created the object (pdfDocument)?

Is there better strategies than to use CreateObject()?

+1  A: 

well the solution that we've found

is to create the application object before we create any application's object. for example: dim objApp as object = CreateObject("AcroExch.App") dim objDoc as Object = CreateObject("AcroExch.document")

... objApp.CloseAllDocuments()

System.Runtime.InteropServices.Marshal.ReleaseComObject(objApp) System.Runtime.InteropServices.Marshal.ReleaseComObject(objDoc)

But next time i will never use CreateObject. I'll try to use framework classes (especially the Runtime and Reflection for such examples)

LolaRun