消息机制是否多线程?
一个类A(继承CWmd),里面有一个消息响应函数FUN(处理消息中的图像buf在类A中的一个窗口中显示),一个Dlg B,创建了10个A的实例(CWnd::Create创建),问题是当10个A的实例在分别处理自己的消息时候,这10个是否是多线程的。一直认为消息机制应该是多线程的,不过今天做测试的时候发现好像不是,有点疑惑了,请大家解答。
[解决办法]
Windows message is totally irrelevant with thread. Windows message is a data structure which need to be sent to a proper window referenced by using a HANDLE value. Windows message can be used in both process and thread,however SendMessage() is not available in thread, you need to use PostMessage instead.
[解决办法]
只要你的A, B是在一个线程中建立的,他们的处理就不会是多线程的