Old Add-In-Express 32-bit to new 64-bit issues

Add-in Express™ Support Service
That's what is more important than anything else

Old Add-In-Express 32-bit to new 64-bit issues
Delphi 7 (Add-In-Express 2009) to latest 
Chris Bishop




Posts: 13
Joined: 2016-01-25
Hi,

I have a trial version of Delphi 10 Seattle and a trial of Add-in-Express and I am trying to prove to myself that it shouldn't be too hard to convert our delphi 7 code base to delphi 10 and upgrade to the latest Add-In-Express all at the same time.

My problem so far is our COM Automation DLL for Excel will not register in 64-bit.
Here is what I have done:

Successfully compiled as 32-bit
Successfully registered it with Excel 32-bit
Successfully compiled as 64-bit
Fail to register with Excel 64-bit ( A dynamic link library (DLL) initialization routine failed)

There both are done as non admin privilege and both had their .ini file.
I also launched Delphi 10 as Admin.

I then proceeded to try the VCL Toys example on your website.
Successfully compiled as 64-bit
Successfully registered it with Excel 64-bit.

When i compare the code in the VCL Toys and my addin I notice a slight different in the wiring up the COM Addin.

I only have the
TDynacViews = class(TaxpAddIn, IDynacViews2)



Class declaration and in the initialization section
TaxpFactory.CreateEx(ComServer, TDynacViews, CLASS_DynacViews2, [ohaExcel],'Dynac Views', 'Dynac Views Excel Add-In');



But in the example they have:


TadxToysXLAddIn = class(TadxAddin, IadxToysXLAddIn)
  end;

  TAddInModule = class(TadxCOMAddInModule)


And the initialization section:

TadxFactory.Create(ComServer, TadxToysXLAddIn, CLASS_adxToysXLAddIn, TAddInModule);


So I believe it has to do with the creation of the Add-in.
I was going to attempt to update our code to mirror the add-in but our add-in has UDF and events all on the one class. I do not know how I would go about breaking up or delegating with the two classes.
I am not event sure the different between TadxAddin and TadxCOMAddInModule.

The help file suggested that TadxAddin had a property exposing the TadxCOMAddinModule but Delphi 10 would not auto complete that for me.

Sorry if any references to Delphi are not correct I am a C# programer who now has ownership of this older delphi project and I am trying to bring it into a new ERA!

Thanks for your help.
Posted 31 Jan, 2016 17:11:32 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Chris,

Could you please send us your project? You can find the support email address in {Add-in Express installation folder}\readme.txt. Please make sure your email contains a link to this topic.


Andrei Smolin
Add-in Express Team Leader
Posted 01 Feb, 2016 05:50:44 Top
Chris Bishop




Posts: 13
Joined: 2016-01-25
Hi Andrei,

Did you receive my project via email?
Posted 02 Feb, 2016 15:09:14 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Chris,

Yes, I did. I'm going to respond later today.


Andrei Smolin
Add-in Express Team Leader
Posted 03 Feb, 2016 04:06:46 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Chris,

#1. In the source code we can't find the file DynacViews2Addin_IMPL.dfm
#2. We can't register your project as well. We don't know if this is caused by the missing file.
#3. We've created a new per-user add-in and it works. You can try to create a new project and move the source code to the new project.
#4. Don't register a 64bit DLL from the IDE; use the command prompt instead.


Andrei Smolin
Add-in Express Team Leader
Posted 03 Feb, 2016 04:22:27 Top
Chris Bishop




Posts: 13
Joined: 2016-01-25
Hi Andrei,

Thanks for looking at the project. It was built with Delphi 7 and Add-in-Express from 2009 ( I think maybe 2007 ).

It doesn't have a DynacViews2Addin_IMPL.dfm. Where you able to get it to register for 32-bit? I can get 32-bit to work but not 64-bit? I am using the command prompt too.


The problem with moving it to a new project is the types used are different as indicated in my first email. But now that you pointed out the dfm file I think I know how to convert to the default add-in template. I was not sure how to wire up the events. Currently I override AddIn_Initialize on TaxpAddin and was't sure how to do this with the TadxCOMAddInModule but I see that in the dfm file that is where the events are hooked up.


Thank you for looking into the issue I believe I will be able to move forward with my 64-bit testing.

I would like to ask for direction in determining how to wire up the following events found on TaxpAddin using TadxCOMAddinModule:

procedure AddIn_ControlEvent(const Tag: string; ICtrl: IaxpControl); override;
procedure AddIn_Initialize; override;
procedure AddIn_Finalize; override;
procedure OnWorkbookActivate( ASender: TObject; const Wb: ExcelWorkbook );
procedure OnWorkbookDeactivate(ASender: TObject; const Wb: ExcelWorkbook);
procedure OnWorkbookBeforeClose(ASender: TObject; const Wb: ExcelWorkbook; var Cancel: WordBool) ;
procedure OnWorkbookBeforeSave(ASender: TObject; const Wb: ExcelWorkbook; SaveAsUI: WordBool; var Cancel: WordBool);
procedure OnSheetActivate(ASender: TObject; const WORKSHEET: IDispatch);
procedure OnSheetBeforeRightClick(ASender: TObject; const Sh: IDispatch; const Target: ExcelRange; var Cancel: WordBool) ;
procedure OnSheetBeforeDoubleClick(ASender: TObject; const WORKSHEET: IDispatch; const Target: ExcelRange; var Cancel: WordBool);
Posted 03 Feb, 2016 09:51:22 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Chris,

I assume this is a *really* old project.

AddIn_ControlEvent is a virtual method which isn't used in new projects. In old projects, you would use it to handle events of the commandbar controls you created in AddIn_Initialize. In new projects, you use design-time editors to create components constituting the command bar and Ribbon UI of your add-in; the components provide corresponding events.

Examples of new projects are published at https://www.add-in-express.com/downloads/adxvcl.php; see the download labelled "Add-in Express for Office and VCL sample projects".

To intercept Excel events, put an Excel Events component - TadxExcelAppEvents - onto the add-in module and handle the events it provides.

Hope this helps.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Feb, 2016 08:40:10 Top
Chris Bishop




Posts: 13
Joined: 2016-01-25
I assume this is a *really* old project.
is very correct.

Thanks for the assistance. Your product has been very helpful with our main product and look forward to using your product to its fullest. And upgrade sooner rather then later next time.
Posted 04 Feb, 2016 09:09:30 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
You are welcome! If you run in a problem, don't hesitate to contact us.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Feb, 2016 09:48:23 Top