开发者

Is it possible to figure out when the switching between design mode and run mode takes place in ActiveX?

开发者 https://www.devze.com 2023-02-04 02:22 出处:网络
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 f

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消