How to find out Active Process Book and Active Display from .Net VB Code?

Hi. I am trying to find out active Process Book from .NET VB code, but do not know how to initialize the object. For example, I want to find out the active process book to open some existing schematic or want to display some trend on the active process Book and active display. I am using the following code, but do not know how to initialize the object.

Dim objPB As PBObjLib.Application

'(How/what to initialize?)
objPB = ?? 
MsgBox(objPB.ActiveProcessBook.Title.ToString)

'I am using following command to open existing PDI file
objPB.Displays.Open("Actual Path", 1)
objPB.ActiveDisplay.SelectedSymbols.Item(1).AddTrace(sTraceName)

Now my question: Am I using correct class object to find out the active process book and active display from .NET VB code. I am using OSIsoft PB add-in template VB code and trying to achieve this from there. Is there any better way we can achieve this? Thanks.

Parents Reply
  • Thanks Andreas. As of now, we are already using this mechanism (m_App), but we need to execute this from another our defined application/class and thatwe are unable to determine how to initialize this object. Otherwise we need to pass this parameter (m_APP) to every other Application/class, but if we can find out this on the fly, then it would be very convenient for us if it is possible. Please let us know if we can initialize this object from any other class or application. Thanks. 

Children