9 Replies Latest reply on Jul 26, 2013 11:18 AM by Marcos Vainer Loeff Branched to a new discussion.

    Problems with Pbobjlib.tlb registration & use.


      I am developing a C# application that essentially uses Pbobjlib.tlb to create a PI ProcessBook application instance, and then do some stuff (load displays etc).  I am having a few little problems, and am trying to diangose / resolve them.  This is a spin-off from this thread: http://vcampus.osisoft.com/discussion_hall/add_in_microsoft_development/f/11/p/4197/22324.aspx


      As noted in that thread, I was having problems with macro protection not firing when application.displays[].open was called.  It was suggested that I instead try using the "Global" class application object, instead of the Application class direct.  When I tried this, I got an error that the class was not registered.  I have been trying to resolve this, and this thread is to get help on the problems I have found.


      Firstly, I am using ProcessBook  Here is the system info:


      PI ProcessBook
          COMCTL32.dll    6.1.7600.16385 6.10.7601.17514 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\
          MFC80.DLL       8.00.50727.4053 8.0.50727.4053 C:\Windows\WinSxS\x86_microsoft.vc80.mfc_1fc8b3b9a1e18e3b_8.0.50727.4053_none_cbf21254470d8752\
          ModContextSupport.ocx 3.02       C:\Program Files\PIPC\Procbook\ModuleContext\
          ModuleContext.dll 3.02       C:\Program Files\PIPC\Procbook\ModuleContext\
          MSO9.DLL        9.0.3610    C:\Program Files\Microsoft Office\Office\
          MSVBVM60.DLL    6.00.9815     C:\Windows\system32\
          MSVCR80.dll     8.00.50727.6195 8.0.50727.6195 C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.6195_none_d09154e044272b9a\
          msvcrt.dll      7.0.7601.17744 7.0.7601.17744 C:\Windows\system32\
          Pblib32.dll       C:\Program Files\PIPC\Procbook\
          pisdk.dll     C:\Program Files\PIPC\PISDK\
          PISDKCommon.dll     C:\Program Files\PIPC\PISDK\
          PISDKDlg.dll    1.06.0365     C:\Program Files\PIPC\PISDK\
          PITimeServer.dll     C:\Program Files\PIPC\LIBRARY\
          Plot.dll       C:\Program Files\PIPC\Procbook\
          Prims32.dll       C:\Program Files\PIPC\Procbook\
          Procbook.exe       C:\Program Files\PIPC\Procbook\
          SQC.DLL       C:\Program Files\PIPC\Procbook\
          svg_addin.dll   3.02       C:\Program Files\PIPC\Procbook\SVG_addin\
          Toolbox.dll       C:\Program Files\PIPC\Procbook\
          Trend32.dll       C:\Program Files\PIPC\Procbook\
          VBE6.DLL        6.05.1054     C:\PROGRA~1\COMMON~1\MICROS~1\VBA\VBA6\
          xyplot.dll       C:\Program Files\PIPC\Procbook\
      Copyright © 1993 - 2010 OSIsoft, LLC


      In my application, I am adding a reference to the Interop.PBObjLib (PI-ProcessBook Type Library, version 3.1 & 3.2, c:\Program Files\PIPC\Procbook\Pbobjlib.tlb) I am assuming that it is a self-registering library.


      Anyway, when I add a reference to this library, it adds OK to my application.  I can run it, and it works properly (creating processbook instances etc), and the only real problems is that macros execute when I programatically open a display.  IN trying to solve that, as per the advice given, when I try to make the following declaration:

                  PBObjLib.Global oPiObject = new PBObjLib.Global();
                  m_oPIApp = oPiObject.Application;

       It compiles fine, but I get a runtime error that:


      Retrieving the COM class factory for component with CLSID {B97046B1-577C-11D0-BACC-00AA00BFB45A} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).


      I decided to try something different.  I had been running my Visual C# IDE as a normal user.  I tried to instead run it as an administrator, and got a whole lot of weird errors when I restarted the IDE:


      Cannot get the file path for type library "0cf87d80-9e07-11cf-840c-00aa00422a4a" version 3.2. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) 


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


      I therefore tried to remove the existing reference, and add a new one.  Trying to add a reference to library 3.2, I get:


      A reference to "PI-Processbook Type Library" could not be created.


      Trying to add a reference to library 3.1, I get:


      A reference to "PI-Processbook Type Library" could not be added. Could not register the ActiveX type library 'C:\Program FIles\PIPC\Procbook\pbobjlib.tlb'.


      So... Thoroughly confused.  Why can I register and use the library when the IDE is as a normal user, but not when started as an administrator?


      Note:  I have uninstalled and reinstalled, including cleaning-out old unused references in the registry.




      Any suggestions appreciated!