I have programmed an ActiveX in MFC. When placed inside a co开发者_开发知识库ntainer, I can use COleControl::AmbientUserMode() to determine if it's now in design mode or run mode. What I want is to find the specific point when the switching between design and run modes takes place. Is there any virtual method or message handler when that happens?
Thanks in advance.
Well, I have figured that out. The following interface member is called when an ambient property is changed.
HRESULT IOleControl::OnAmbientPropertyChange([in] DISPID dispiD)
If you switch between design and run modes, OnAmbientPropertyChange is called with dispid value of DISPID_AMBIENT_USERMODE. So you can override it to implement your own code.
精彩评论