Главная страница | назад





Article #17672: Message handlers for ActiveX controls

 Question and Answer Database

FAQ2672C.txt   Message handlers for ActiveX controls
Category   :ActiveX
Platform    :All
Product    :C++Builder  3.x

Question:
Why, when I have a VCL component, that has a message 
handler in it, does the assistant fail when creating the 
code and report errors from the message handler macros.

How can I still use this message handler with my ActiveX?

The message handler looks like (as it should):
BEGIN_MESSAGE_MAP
 MESSAGE_HANDLER(WM_ERASEBKGND,TWMEraseBkgnd,WMEraseBkgnd)
END_MESSAGE_MAP(TCustomControl)

Answer:
Change
 MESSAGE_HANDLER(WM_ERASEBKGND,TWMEraseBkgnd,WMEraseBkgnd)
to
 VCL_MESSAGE_HANDLER(WM_ERASEBKGND,TWMEraseBkgnd,WMEraseBkgnd)

This is necessary due to the fact that ATL has a 
macro defined as MESSAGE_HANDLER. Use of the VCL_ 
prefix works fine even if you don't try to convert 
to ActiveX.

7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99