Announcement

Collapse
No announcement yet.

Excel com automation addin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #21
    These calls are never executed in PB9.
    I have used a messagebox.
    I have the same crash now.

    For registering (not an issue yet) i have used this:

    Code:
        Local T         As String
        Local szKey     As Asciiz * %MAX_PATH
        Local lResult   As Long    
    
        Select Case fwdReason
        Case %DLL_PROCESS_ATTACH
    
            ghInstance = hInstance
            ' We don't need to do any thread initialization
            DisableThreadLibraryCalls hInstance
    
        Case %DLL_THREAD_ATTACH
        Case %DLL_PROCESS_DETACH
    
            T = VD_Registry_ReadStr( %HKEY_CLASSES_ROOT, "CLSABABAB\CLSID", "", "" )
            'MsgBox "'" & T & "'"        
            If Len( T ) Then
                szKey = "CLSID\"
                lstrcat szKey, GuidTxt$($CLSID_CEXCELADDINPB)
                If VD_Registry_Exist( %HKEY_CLASSES_ROOT, szKey & "\Programmable", "" ) = 0 Then
                    DllRegisterServer2()
                End If
            Else
                DllUnregisterServer2()
            End If
    
        Case %DLL_THREAD_DETACH
        End Select
    
        Function = 1
    I am pretty tired of this excel mess, will go on though..
    hellobasic

    Comment


      #22
      I did not want to post the following log, because I have not found the time to
      do a more detailed analysis. This is a partial output of the log for the low-level
      COM version. I also indicate where the PB9-COM vesion fails.
      Code:
      DllGetClassObject
      IClassFactory::Create
      IClassFactory::QueryInterface(0)
      IClassFactory_AddRef(cRef=2)
      IClassFactory_Release(cRef=1)
      IClassFactory::CreateInstance
      EXCELADDIN CLASS - CExcelAddIn_Create
      IExcelAddIn_Create
      IExcelAddIn::QueryInterface({00020400-0000-0000-C000-000000000046} IDISPATCH                   )
      IExcelAddIn-IUnknown::QueryInterface(0)
      IExcelAddIn-IUnknown::AddRef(cRef=2)
      IExcelAddIn-IUnknown_Release(cRef=1)
      IExcelAddIn-IUnknown::AddRef(cRef=2)
      IExcelAddIn-IUnknown_Release(cRef=1)
      IClassFactory_Release(cRef=0)
      IExcelAddIn::QueryInterface({00020400-0000-0000-C000-000000000046} IDISPATCH                   )
      IExcelAddIn-IUnknown::QueryInterface(0)
      IExcelAddIn-IUnknown::AddRef(cRef=2)
      IExcelAddIn-IUnknown_Release(cRef=1)
      IExcelAddIn::QueryInterface({E19C7100-9709-4DB7-9373-E7B518B47086})
      IExcelAddIn-IUnknown::QueryInterface(80004002)
      IExcelAddIn::QueryInterface({B65AD801-ABAF-11D0-BB8B-00A0C90F2744})
      IExcelAddIn-IUnknown::QueryInterface(80004002)
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames
      IExcelAddIn::GetIDsOfNames   <---- The PB9-COM version fails immediately after this
      IExcelAddIn::GetTypeInfo
      Another thing I noticed, is that with the PB9-COM version there is a call to CoCreateInstance whereas with the
      low-level COM version CoCreateInstance is not called. Maybe my utility is just missing it.

      I also noticed, and this was by accident, if the following lines

      Code:
          @pVtbl.get_TestDate          = CODEPTR(IExcelAddIn_get_TestDate     )
          @pVtbl.get_TestCapital       = CODEPTR(IExcelAddIn_get_TestCapital  )
      are commented out in the virtual table below

      Code:
        pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
        IF pVtbl THEN
          @pVtbl.QueryInterface        = CODEPTR(xlaIUnknown_QueryInterface   )
          @pVtbl.AddRef                = CODEPTR(xlaIUnknown_AddRef           )
          @pVtbl.Release               = CODEPTR(xlaIUnknown_Release          )
          @pVtbl.GetTypeInfoCount      = CODEPTR(xlaIDispatch_GetTypeInfoCount)
          @pVtbl.GetTypeInfo           = CODEPTR(xlaIDispatch_GetTypeInfo     )
          @pVtbl.GetIDsOfNames         = CODEPTR(xlaIDispatch_GetIDsOfNames   )
          @pVtbl.Invoke                = CODEPTR(xlaIDispatch_Invoke          )
          ' ExcelAddIn properties
          @pVtbl.get_TestDate          = CODEPTR(IExcelAddIn_get_TestDate     )
          @pVtbl.get_TestCapital       = CODEPTR(IExcelAddIn_get_TestCapital  )
          ' ExcelAddIn methods
        END IF
      the low-level COM fails at the same point as the PB9-COM version.

      I am pretty tired of this excel mess, will go on though..
      You can always use low-level COM. It is not difficult.
      Dominic Mitchell
      Phoenix Visual Designer
      http://www.phnxthunder.com

      Comment


        #23
        First of thanks to Edwin and Dominic for all their hard work on this.
        I know that there are alot of user who are interested in this subject.

        I can not seem to get Dominic's dll to work. It register's fine using regsvr32.

        I can not however see it in the com list in Excel.

        I am running Excel 2007 so I use Excel Options then Add-ins then select COM Add-ins.

        Is not suposed to show up there on that list?

        Keep up the great work I know I will follow it closely.

        Blair,

        Comment


          #24
          Sorry,

          I figured it out.

          It was under Excel Add-in not Com Add-in.


          Blair,

          Comment


            #25
            If you would like to try a COM Add-in, maybe I can post a sample using PB9-COM. If my suspicions are correct, a PB9-COM Add-in should work.
            Dominic Mitchell
            Phoenix Visual Designer
            http://www.phnxthunder.com

            Comment


              #26
              That woul be great if you have an example already done.

              Blair,

              Comment


                #27
                It support the Excel of Which version?
                It seems not work on MS Excel 2003.
                And it?

                Comment

                Working...
                X
                😀
                🥰
                🤢
                😎
                😡
                👍
                👎