6 Replies Latest reply on Oct 21, 2009 6:37 AM by JanvanderVen

    Strange behaviour on a 64 bit system

    JanvanderVen
      Dear VCampus members, I wanted to write my first process book add-in on my Vista 64 bit system. I had already installed the 64 bit SDK and PI OleDB. I added ProcessBook to that installation and the C# templates. I then started Visual Studio Express 2008, started a Simple Add-In template and tweaked my csproj to produce x86 code as described here: http://coffeedrivendevelopment.blogspot.com/2008/06/hacking-vs-c-2008-express.html. I also had to change the location of PI ProcessBook as it is in the Program Files (x86) folder. Without any coding on my part, I started the debugger and ProcessBook started up and gave an error: "Exception in OnConnection Error HRESULT EFAIL has been returned from a call to a COM Component". The breakpoint I set on this line:                 m_theApp = (PBObjLib.Application)Application; was not reached. Later that day I used PB with a PDI file that had some code behind the form. This also failed in the UpdateValue function. I feel that these problems arise from the 64 bit "something" getting called instead of the 32bit. Can someone confirm this? Is there a workaround? Kind regards, Jan
        • Re: Strange behaviour on a 64 bit system
          andreas

          That gives me a reason to install a 64bit OS

           

          However, you are introducing two issues here: 1. The 64bit system and 2. the Visual Studio Express.

           

          Jan van der Ven

          Later that day I used PB with a PDI file that had some code behind the form. This also failed in the UpdateValue function.

           

          Can you provide the PDI file or some code to demonstrate the issue?

           

          regards,

            • Re: Strange behaviour on a 64 bit system

              Andreas, when you do your tests I seem to remember seeing something similar but can't exactly remember order & details
              I think the issue I had is because the 64bit SDK is installed after the 32bit SDK in the same directory - ProcessBook is installed (32bit SDK) on 64bit OS that puts SDK files in "...PIPC\PISDK" (I didn't put it in "..PIPC (x86)\PISDK"), then for other tasks I installed 64bit SDK in to the same directory.  So the registry for 32bit PISDK points to the same directory where 64bit SDK now resides.  Had to do some fiddling with the registry and a reinstall of SDK's to get it to work properly.

               

              As I said I am relying on my overworked brain to remember that one, so it might not be entirely accurate.

                • Re: Strange behaviour on a 64 bit system
                  andreas

                  So after Rhys warning I did install first the PI ProcessBook (with the 32bit PI SDK) in the Program Files (x86) folder and tested the PDI - works fine. Afterwards I did install the 64bit PI SDK in the Program Files folder and tested again - same result.

                   

                  Did you install the 64bit PI SDK prior to the 32bit, or like I did first the 32bit PI SDK and later the 64bit?

                   

                  regards,

                    • Re: Strange behaviour on a 64 bit system
                      JanvanderVen

                      Hi Andreas,

                       

                      64 bit first.

                       

                      I'll reinstall everything in your order and see what happens.

                       

                      Kind regards.

                       

                      Jan

                        • Re: Strange behaviour on a 64 bit system
                          JanvanderVen

                          Dear Andreas,

                           

                          So I uninstalled everything from OsiSoft (I did not uninstall the two Microsoft prerequisites kits).

                           

                          Then I installed ProcessBook, ran my PDI again and got the same error message. I dug a bit deeper and found that my computer and the PI Server had a +10 minute time difference, which was causing the error. This was not related to ProcessBook at all. Sorry for that.

                           

                          I then started the add-in project again, but that kept complaining about COM exceptions. I started a completely new project and this time I only changed the location of ProcBook.exe to Program Files (x86). Surprisingly this also worked. This is something I do not understand. As far as I know VS C# 2008 Express will create 64 bit code by default on a 64 bit system. However, when I inspected the dll with depends (http://www.dependencywalker.com/) it showed it as x86.

                           

                          Finally I installed the 64 bit version of PIOLEDB, and verified that that worked as well.

                           

                          Thanks everybody for helping me out.

                           

                          Kind regards,
                          Jan

                    • Re: Strange behaviour on a 64 bit system
                      JanvanderVen

                      Dear Andreas,

                       

                       

                       

                      Thank you for your quick reply.

                       

                      The 32 bit SDK is in Program Files (x86)\PIPC

                       

                      and the 64 bit SDK is in Program Files\PIPC

                       

                      This is the output of the About ProcessBook:

                      PI ProcessBook
                      Version 3.2.0.0
                          COMCTL32.dll       6.0.6001.18000    6.10.6002.18005    C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18005_none_5cb72f96088b0de0\
                          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             3.2.0.0          C:\Program Files (x86)\PIPC\PROCBOOK\ModuleContext\
                          ModuleContext.dll    3.02             3.2.0.0          C:\Program Files (x86)\PIPC\PROCBOOK\ModuleContext\
                          MSO9.DLL           9.0.4402         9.0.0.4402       C:\Windows\SysWOW64\Office\
                          MSVBVM60.DLL       6.00.9802        6.0.98.2         C:\Windows\system32\
                          MSVCR80.dll        8.00.50727.4053    8.0.50727.4053    C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4053_none_d08d7da0442a985d\
                          msvcrt.dll         7.0.6002.18005    7.0.6002.18005    C:\Windows\syswow64\
                          Pblib32.dll        3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          pisdk.dll          1.3.6.0          1.3.6.363        C:\Program Files (x86)\PIPC\PISDK\
                          PISDKCommon.dll    1.3.6.0          1.3.6.361        C:\Program Files (x86)\PIPC\PISDK\
                          PISDKDlg.dll       1.06.0365        1.6.0.365        C:\Program Files (x86)\PIPC\PISDK\
                          PITimeServer.dll    1.3.6.0          1.3.6.361        C:\Program Files (x86)\PIPC\Library\
                          Plot.dll           3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          Prims32.dll        3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          Procbook.exe       3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          SQC.DLL            3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          svg_addin.dll      3.02             3.2.0.0          C:\Program Files (x86)\PIPC\PROCBOOK\SVG_addin\
                          Toolbox.dll        3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          Trend32.dll        3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                          VBE6.DLL           6.05.1032        6.5.10.32        C:\PROGRA~2\COMMON~1\MICROS~1\VBA\VBA6\
                          xyplot.dll         3.2.0.0          3.2.0.0          C:\Program Files (x86)\PIPC\Procbook\
                      Copyright © 1993 - 2009 OSIsoft, Inc.

                      Progra~2 is also the (x86) folder.

                       

                      The code behind the PDI is this:

                      Public Sub WriteNumericValue(tag As String, val As Double, timeStamp As Variant, Optional checkType As Boolean = True)
                          On Error GoTo WriteValue_Error

                          'bepaal de default server
                          Dim pisvr As PISDK.Server
                          Set pisvr = PISDK.Servers.DefaultServer

                          'zet het tijdstempel in een algemeen formaat
                          Dim ptf As PITimeFormat
                          Set ptf = New PITimeFormat
                          Select Case VarType(timeStamp)
                              Case vbDate
                                  ptf.LocalDate = timeStamp
                              Case vbString
                                  ptf.InputString = timeStamp
                              Case Else
                                  MsgBox "Onbekend type voor timestamp: " + TypeName(timeStamp)
                                  Exit Sub
                          End Select

                          'type checking staat standaard aan, maar kan met de checkType parameter worden uitgezet om wat snelheidswinst te halen
                          If checkType Then
                              Dim pointType As Integer
                              pointType = pisvr.PIPoints(tag).pointType
                              'PI pointtype mag alleen een float32, float64 if int32 zijn
                              If pointType <> PISDK.pttypFloat32 And pointType <> PISDK.pttypFloat64 And pointType <> PISDK.pttypInt32 Then
                                  MsgBox ("Verkeerd datatype voor tag '" + tag + "'")
                                  Exit Sub
                              End If
                          End If

                          'schrijf de waarde naar de tag
                          pisvr.PIPoints(tag).Data.UpdateValue val, ptf   ' error here   
                      WriteValue_Exit:
                          On Error GoTo 0
                          Exit Sub

                      WriteValue_Error:
                          MsgBox "Fout tijdens het schijven van tag '" + tag + "'"
                          Resume WriteValue_Exit
                      End Sub