Click to See Complete Forum and Search --> : CEdit and CStatic within an ActiveX control


April 8th, 1999, 06:16 AM
Dear all,

I am trying to create an ActiveX control (within in VC 6.0) that contains a CStatic and CEdit control. All works fine within the test container, however when I try adding my control from the gallery to a dialog within VC get a assertion that the controls m_hwnd have not been created.

The Create() function does not fail, and says its been created okay. I do not really want to use a ActiveX control with a dialog resource.

The assert happens when the control trys displaying a value, could it be to do with the control state, and I should not draw during the design mode, if so how?


Thanks would be appreciated for any help....


Matthew
matt@barretts.demon.co.uk

April 9th, 1999, 12:43 AM
Hello,
I don't quite understand Your problem.
Do You get the assertion failed while putting Your ActiveX control into the dialog template? In this case You have to modify the OnDraw function of Your control to check whether the m_hWnd is created yet and do some default drawing that needs no window objects. The reason for that problem is, that the template calls in design time the OnDraw of Your control without creating it correctly (not quite sure whether it creates anything at all).
If the problem arises while starting the container: Did You call AfxEnableControlContainer() in the App::InitInstance function of the application with the dialog in which You want to put the ActiveX control?
Hope this helps,
Rudolf

May 28th, 1999, 11:40 AM
Hi,
Could you kindly tell me what kinda of default drawing would you do in your OnDraw function in order to recreate the exact look and feel of the CEdit and CStatic control? I hate to keep on seeing my control appearing as the default gray box with text : "ATL Composite Control". Any help is greatly appreciated!!

Regards
Jeff