4 Replies Latest reply on Feb 16, 2012 5:46 PM by dhollebeek

    Sending information to ProcessBook Add-In from display's VBA code

    sFung

      We're trying to replace our old VB6 ActiveX control with .Net code, and the only possible solution seems to be converting the ActiveX control to .Net docking window Add-In.  My primary concern is sending additional custom information (URLs, non-PI server names, etc...) from the display to the docking window Add-In.

       

      After talking to some folks at OSISoft, they said it's possible to send information from the display to a docking window Add-In, but I browsed through the ProcessBook VBA Object Browser and didn't see anything useful.

       

      Does anyone know if this is possible?  If so, any sample code?

       

      Thanks in advance!

        • Re: Sending information to ProcessBook Add-In from display's VBA code
          MvanderVeeken

          Best place to start would be watching the Programming .NET Add-Ins for PI ProcessBook webinar. There are ProcessBook .NET templates for Visual Studio available in the Download Center (under 'Extra's')

           

          There are some interesting topics where other members describe their efforts in creating Processbook Add-Ins with .NET. You can use the search to find them.

           

          Complements on the extensive tagging of your post

            • Re: Sending information to ProcessBook Add-In from display's VBA code
              sFung

              Thank you for the information, but the webinar only went over simple Add-Ins.  I have written a few ProcessBook Add-Ins before and have never seen anything that would allow a display's VBA code to call a public function in the Add-In, and that's what I'm trying to do now.  Just wanted to know if that's even possible...

                • Re: Sending information to ProcessBook Add-In from display's VBA code
                  dhollebeek

                  I played with this a while ago, and my memory is that I got it to work.  I'll dig through my posts and examples and see if I can find the instructions for it.

                    • Re: Sending information to ProcessBook Add-In from display's VBA code
                      dhollebeek

                      I found the example and it for calling methods in one display from another, so it's not what you want.  However, I believe what you are asking to do is do-able.

                       

                      First of all, take a look at the AFWrapper example that was recently added to the "Extras" section.  This shows how to call C# .Net code from VBA.  If you develop your own .Net helper methods in a separate dll, then you have 2 options:

                       

                      1) You can create the docking window in the C# code.  This however means that you will have one docking window per display.  Which may not be what you want.  Or ...

                       

                      2) If you link the C# helper dll into both the VBA code and your add-in, you can have a global variable (or various variables) that point to the add-in's Connect and other classes.  In the add-in's connect class in OnConnections, you can then set these global variables so that the helper dll has access to the add-in.  Then when VBA calls the helper dll, you can call methods in these objects to access methods in the add-in.

                       

                      If you let me know exactly what you are trying to do, I can help you out with sample code to get this written.

                       

                      You can either contact me on the forums, or my email address is dhollebeek at osisoft dot com.