I am building an ATL ActiveX Control that is intended for Visual Basic.
I need to do some initialization before my control is run at run-time, but this may not happen at design time. How can I do this. I know about the ambient setting "usermode" to tell whether I am in run mode or design mode.
I have tried deriving OnAmbientPropertyChange like this:
STDMETHODIMP Cr6dx::OnAmbientPropertyChange(DISPID dispid)
And this works fine from the test container but OnAmbientPropertyChange is never called via VB so I cannot detect the mode change there.
Is there any other way I can use?
I have several ideas, such as putting the code for initialization in OnDraw and then testing for change of mode. Is such an approach stable?