ActiveX Events and MFC State
来源:互联网 发布:java实现oracle jdbc 编辑:程序博客网 时间:2024/05/22 07:08
http://www.codeproject.com/Articles/7128/ActiveX-Events-and-MFC-State
ATL ActiveX Event Sink
This approach involves creating an IDispEventSimpleImpl
derived class. Once again, methods must be added to match the event source.
Unlike the MFC approach, in this case you are responsible for managing the MFC state yourself. To do this, you should make use of the AFX_MANAGE_STATE
macro discussed earlier. In this case however, since the event sink object is instantiated in the main application, use the AfxGetAppModuleState()
function to supply the pointer to theAFX_MODULE_STATE
structure.
For example, a typical event sink function for an object constructed in the main application should start with the following code.
//// Make sure the MFC state is correct.// AFX_MANAGE_STATE(AfxGetAppModuleState()) //// The rest of your code...//
As mentioned earlier, when this function returns, the MFC state will be automatically restored.
The demo program illustrates the use of this technique in the CAtlEventSink
class.
Note: there are some exceptions to the state management rules which make this topic even more confusing. Regular dlls that statically link to MFC and MFC extension dll's should not use AFX_MANAGE_STATE
. See the MSDN article "Regular DLLs Dynamically Linked to MFC" for further details.
- ActiveX Events and MFC State
- MFC ActiveX
- MFC ActiveX
- MFC-ActiveX
- How to start a second thread in an MFC-based ActiveX control to fire events in Visual C++
- Properties, methods and events
- Events and Delegates simplified
- 弄清楚Events and Delegates
- Observers and Dispatching Events
- STM32L--Interrupts and events
- GTK+ events and signals
- Threads, Events and QObjects
- Touch Events and UIResponder
- .Net 's delegates and events
- Page Events: Order and PostBack
- jsf lifecycle and 4 events
- System Events and Mouse Messages
- [译] Threads, Events and QObjects
- LoadLibrary和GetProcAddress获得API的地址
- C++多线程实例(_beginThreadex创建多线程)
- java.lang.IllegalArgumentException: id to load is required for loading
- linux静态IP配置
- 如何设置一个严格30分钟过期的Session
- ActiveX Events and MFC State
- 联合体(union)和结构体(struct)的区别
- 初识进程这家伙
- 机器学习 cs229学习笔记2 (k-means,EM & Mixture of Gaussians)
- unix网络编程之套接字地址结构
- 一 redis学习笔记之环境搭建
- SQL ORACLE 查询 日期条件
- 全排列问题
- 进程上下文和中断上下文