Discussion Locked

Inserting a 32bit control in 16bit App.

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Have any one tried to load a 32 bit Activex control inside a 16 bit application.I have a 16bit application,i need to insert an activex control in that 16bit App window.I belive, some one would have worked on this
earlier.

When i tried doing this, I couldn't insert a 32 bit control directly in the 16bit Application.So i wrapped my control into a 32bit DLL and thunked the DLL method from the 16bit App to create the control.

The creation of Control fails while calling CoGetClassObject. I checked out the HRESULT value returned by the CoGetClassObject, it says that "An implementation of the requested class could not be located".

But,a Win32Application is succesful in calling the CoGetClassObject. I could create the instance and also getting the IDispatch interface pointer.

I can also assure that,it's possible to insert a sample window in the 16bit Application via thunking.

Now the Action is Like this:

16bitApp ------> CreateControl() in 32bit DLL
CreateControl() in 32bit DLL -----> CoGetClassObject()

Can any one help me,to create the Control.

Your sugession or any new approaches are welcome.
Thank you.

2 replies

by dljohnston

Just an idea -- perhaps there are more dlls you need to thunk down to 16bit? Other than that I'm not sure.
/R/
D

by ytvsoftware

The idea is correct in general, but you cannot just create the OCX control by the way you described. Look at ATL technique.
But there is one more simple way. Create in your DLL a modeless dialog and by convential way place on it the ocx control. Then call from your application those dialog. Surely resize it and move as you want. To make the dialog keep focus use System Modal option in the template. Surely take care of deleting of the poiter reserved memory after end of use. If you need more than one instance do not allocate memory for dialog as a global variable in DLL.

This discussion is closed to new replies.