4 Replies Latest reply on Dec 3, 2013 2:06 PM by helgesonc

    PB Add-in Development Breadcrumbs

    israelsebw

      Hey everyone!

       

      I am new to PI SDK development, and for that matter development in general.

       

      I am making this post to combine in one place several other posts that helped me to get an add-in up and running.

       

      Here we go:

       

      My system spec.'s Windows 7 x64, PB 3.3.0.949, Visual Studio 2012

       

      Setup:

      • First thing, we need to download the add-in templates: These are found in the download center in the extras section: http://vcampus.osisoft.com/Custom/downloadcenter/download.aspx.
      • Once you have the templates copied to the ...\My Documents\Visual Studio XXXX\Templates\ProjectTemplates or other path of choice, then you can begin a project

      Development:

       

      My first step was to open a template (I chose the Docking Window add-in template) and get it to compile, and allow me to debug. I am not yet focused on making any changes to the template code

      4162.Capture.PNG 

      • With a unique GUID you now need to build the project and register  "YourAssemblyName.dll" using RegAsm.exe. I did this using the developer commant prompt, navigating to the Procbook directory (where I built the project) and typing "regasm YourAssemblyName.dll".
      • In order to get the code to run in PB it is necessary to Link the add-in to PB through the registry. You will need to run the "AddinReg.reg" file included with the template. I did this manually. 

       

      • If you are running an x64 PC like me, then you need to make sure the you also add the add-in to the x64 part of the registry. I found this information on this post: http://vcampus.osisoft.com/discussion_hall/add_in_microsoft_development/f/11/t/2654.aspx5228.Capture.PNG
      • Remember that every one of these steps are important. Unfortunately I discovered the unique GUID one last and until then could not get the add-in to show up in PB. It was pretty frustrating. As always after you know the correct steps it is obvious why it didn't work. 

      Venturing a bit further:

       

      Now that I was able to build the add-in and bring it up in debug mode I decided to venture a bit further. The default add-in has text inside the dock window. I wanted to add a different activeX control.

       

      The bottleneck was this line of code:

       

      8203.Capture.PNG

       

       I had to go find the "ProcID" of the activeX object that I wanted to add. This proved to be a bit more difficult than it seems. In the end these were the steps I followed:

      • Locate the activeX control that I wanted to add using the control browser in PB

      7840.Capture.PNG

      •  My control in this case: msdatgrd.ocx. I searched "msdatgrd.ocs CLSID" on the web and came up with the CLSID {CDE57A43-8B86-11D0-B3C6-00A0C90AEA82}. I prefer to put the ProgID since it is a plain english (or at least trying to be) representation so I searched in the registry for the CLSID and found the "CurVer" in this case was equal to "MSDataGridLib.DataGrid.1" I presume this can be done in an easier way but I don't know what it is.

      This is all of my progress so far. If anyone has better solutions or other threads they would like to refer to that would be great. I would like to know how I could have done this better or in a more streamlined way. I'll continue to post as I make more progress.

       

      Hopefully this can be helpful for someone coming down the road after me.