Jump to content
The Code Captain

Calling a VB6 ActiveX from Delphi 11.3

Recommended Posts

Hi,

 

We want to use a specialist Active X control that's written in VB6.  We have imported the TLB and can make calls.  We are having issues where we get 'division by zero' (and possibly some other floating point errors) on some calls.  I have a vague recollection that this is to do with the 8087 control word (we're working in 32 bit here).  I have tried setting the control word before calling the methods that cause the error to a value I found reported as the 'MS Visual Studio default' (different to the Delphi default).  This has not prevented us getting the error.

 

The author of the VB6 control is still available but cannot provide any help with anything that's not VB6.

 

Does anybody have any hints on how to successfully call a VB6 control from Delphi please.

 

Thanks for looking ...

Share this post


Link to post

I used in the far past this setting (only one time, at the begin of Delphi program, or better in the thread where the ActiveX is instantiated) before calling any MS ActiveX:

Set8087CW($27f);

Hope this help.

Edited by DelphiUdIT

Share this post


Link to post

Thanks for your response.  We have Set8087CW call in place already.  We asked Chat GPT and it suggested that we should use $1332 and that has worked.  I don't think I have seen that value documented anywhere else, but then MS are backers of chat gpt so ...

Share this post


Link to post

Tihs article explains something .... the $1332 value was a predefined default value on some old Delphi editions .... may be before Delphi 12 in wich they change the standard mask of FPU exception.
I don't know if this is a casuality about the standard VB setting needed to work, but ...

 

EDIT: https://stackoverflow.com/questions/39684161/why-an-application-starts-with-fpu-control-word-different-than-default8087cw

Edited by DelphiUdIT

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×