Link to home
Start Free TrialLog in
Avatar of yakky
yakky

asked on

How do I display an Active X control

Iam writting an Active X control, which uses another Active X control.
When I put the child Ole control in a dialog box, the dialog box is nolonger invoked and the child Ole control fails to initialize.

Could someone tell me how I
1. initialize the child Ole control?
2. display the dialog box?

Thanks in advance
Ian Robertson
Avatar of chensu
chensu
Flag of Canada image

The ActiveX control you are using should be registered properly.
1) Make sure your control is registered by using the following command line from your \windows\system directory.

regsvr32 control.ocx

If you get an error (385 or so) then you're missing a dll that you're relying on.

If the control is not registered correctly, then when you call your DoModal, then it will just return and do nothing.  Very annoying.

Also make sure that the control is added properly to your project.  Do a 'Project - Add to project - ActiveX components' EVERY time you add a new method or a new property.  Otherwise, you get 'Bad number of parameters'.

Phillip
Avatar of yakky
yakky

ASKER

Ok let me explain a bit more. Both controls are properly registered.
Try the following for your self. Use visual C++'s ActiveX wizard
to create an active X control. Add a dialog box and then in the ctrl's function which invokes the Aboutbox place a call to invoke the new dialog box.
compile it then run it in the test container. What happens is that first the dialog box is displayed followed by the About box.

Now insert the Calendar control into the dialog box. recompile. What happens is that the dialog box doesnt display, only the about box. Also the Calendar control fails to initialize so none of its methods/property's can be used.

PS the Calendar control does work since Ive tried the same thing as an executable.
So, do you want a different ActiveX control (calendar) in your current ActiveX's about dialog box, correct?  I've run into this problem before, I'll try to remember.  If I'm incorrect in the assumption, please clarify.

Phillip
Avatar of yakky

ASKER

yep correct.
yakky,

Go ahead and reject my answer to open it up to other users if you wish.  

The problem that I was encountering was when I added an ActiveX control to a property sheet in an application, not to a dialog box.  I'm afraid I'm not going to be able to help you with this one at this time.  Too busy.

Phillip
Avatar of yakky

ASKER

see above
Avatar of yakky

ASKER

Adjusted points to 300
ASKER CERTIFIED SOLUTION
Avatar of graber
graber
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>Now insert the Calendar control into the dialog box.

Is the dialog box an ActiveX control container? Did you call AfxEnableControlContainer?
Just curious, have you solved the problem? If so, how?
Ian
  I did some looking into the pricing.  $99.00 per incident...that isn't cheap
Gregg
Ian
  I did some looking into the pricing.  $99.00 per incident...that isn't cheap.  BTW when you get an answer give me a hollar at
garaber@fedex.com and let me know what microsoft has to say.
Gregg