Jump to content
Mike Torrettinni

Can 32bit dll with Form/Frame be used in 64 bit project?

Recommended Posts

This is just a theory, concept question, just to see if it makes sense to explore: I have an activex charting control and I only have 32 bit version, old control that can't be replaced, yet. This is one of the things preventing me to move project to 64 bit.

I was thinking of wrapping this control into 32 bit dll with Form/Frame and then I can move the project to 64 bit and integrate the Form/Frame from the dll.

 

I have no experience with dll that can show visual controls, Forms/Frames. Right now I have this charting control attached to the PageControl Tab, I assume I can a show the same chart from dll.

 

Is this worth exploring or 32 bit dll with form/frame can't be used in 64bit project?

 

 

Share this post


Link to post

"Can 32bit dll with Form/Frame be used in 64 bit project?"

 

No. You can't mix different bitness modules in the same process. 

  • Thanks 1

Share this post


Link to post
3 hours ago, Mike Torrettinni said:

I was thinking of wrapping this control into 32 bit dll with Form/Frame and then I can move the project to 64 bit and integrate the Form/Frame from the dll.

Right idea, but wrong solution.  A DLL Surrogate can be registered to act as a proxy, allowing a 32bit DLL server to be accessible to a 64bit process.  Not sure if this will work for your ActiveX control since it uses a UI, but it might be worth investigating.

3 hours ago, Mike Torrettinni said:

I have no experience with dll that can show visual controls, Forms/Frames.

For that to work correctly, you would need to make a BPL package, not a plain DLL.  But the same 32bit/64bit restriction applies to packages, too.

3 hours ago, Mike Torrettinni said:

Is this worth exploring or 32 bit dll with form/frame can't be used in 64bit project?

No, a 32bit DLL/BPL cannot be used directly in a 64bit process.  If the above doesn't work for your control, you may have to separate out your UI into its own 32bit program, and have your main 64bit program communicate with it using an IPC mechanism.

  • Thanks 1

Share this post


Link to post

Long time ago, I wrote an application which hosted forms from another application, both are exe files. The host application run the child application and find the handle of the form to be embedded, then it change his parent. Windows will make the child window appear in the host application as child!

 

In your case, you write both applications. The host is 64 bit and the child is 32 bit wrapping the 32 bit ActiveX. You can even ease the communication between the two instead of using API to enumerate process and windows to find what you need and transfer data between the two applications.

  • Like 1
  • Thanks 2

Share this post


Link to post

Cross process window parent relationships are something that in principle can be done, but in practise seldom work out. 

 

In reality the shortest route to your goal is almost certainly to replace the charting code. With an added benefit of also being the long term solution. 

Share this post


Link to post
5 hours ago, FPiette said:

Long time ago, I wrote an application which hosted forms from another application, both are exe files. The host application run the child application and find the handle of the form to be embedded, then it change his parent. Windows will make the child window appear in the host application as child!

Interesting, Do you remember any big issues or was it as easy as you describing it?

6 hours ago, FPiette said:

You can even ease the communication between the two instead of using API to enumerate process and windows to find what you need and transfer data between the two applications.

Can you rephrase this, please... I'm not sure you are suggesting to use API or NOT to use API? Could WM_COPYDATA be used for communication?

Share this post


Link to post
3 hours ago, David Heffernan said:

In reality the shortest route to your goal is almost certainly to replace the charting code. With an added benefit of also being the long term solution. 

Yes, I agree, that is long term plan. All the charting components I looked at would require some customization for same results. So, no good replacement/solution has been found, yet.

Share this post


Link to post
23 minutes ago, Mike Torrettinni said:

Do you remember any big issues or was it as easy as you describing it?

It was easy except for tabbing where I had some difficulties to have tabbing working as usual in the host application form having embedded a form from the child process. The goal was to has what the user see (two forms actually) acting like a single form.

Share this post


Link to post
26 minutes ago, Mike Torrettinni said:

an you rephrase this, please... I'm not sure you are suggesting to use API or NOT to use API? Could WM_COPYDATA be used for communication?

I mean since you write both application, you may use any inter-process communication to pass data between the two application (for example form's handle). If you like WM_COPYDATA, you can use it, or you can use a pipe or a socket or shared memory. You have the choice.

Share this post


Link to post
Just now, FPiette said:

I mean since you write both application, you may use any inter-process communication to pass data between the two application (for example form's handle). If you like WM_COPYDATA, you can use it, or you can use a pipe or a socket or shared memory. You have the choice.

Aha, thanks. I used WM_COPYDATA before, so if it works, I will try this and not to go too far into the unknown.

Share this post


Link to post
11 hours ago, Remy Lebeau said:

If the above doesn't work for your control, you may have to separate out your UI into its own 32bit program, and have your main 64bit program communicate with it using an IPC mechanism.

Hm, not sure this would be acceptable for users. Or perhaps they might just accept it, if the feature works and is useful for them, they might accept the fact that it shows up in another program.

 

Will think about it. Thanks!

Share this post


Link to post

Absolute insanity to attempt cross process window parent / child relationships. Not supported by MS amongst many many problems. Read what Raymond Chen has to say on the matter.

 

It blows my mind that people keep on suggesting this. 

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

×