Solved

How to pass WM_CTLCOLORBTN to a ActiveX Control

Posted on 1998-08-05
5
339 Views
Last Modified: 2013-11-19
I'm trying to send a WM_CTLCOLORBTN message to a Active Control.  That control has been created by the MFC Control Wizard.
Using other application, I'm calling the PostMessage to send WM_CTLCOLORBTN msg to the ActiveX Control, but it isn't receiving the msg.
I've put the ON_MESSAGE( WM_CTLCOLORBTN, OnColorBtn ) statement inside the Control and implemented the OnColorBtn() method.
I've seen that no message arrived in OnColorBtn.
Important: I did the following test:
  I replaced WM_CTLCOLORBTN by a WM_USER + xxx and it worked.  So, it seems that there's some trick to MFC ActiveX work with WM_CTLCOLORBTN.
0
Comment
Question by:edsont
  • 3
5 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1320274
Instead of using ON_MESSAGE(WM_CTLCOLORBTN), try using

 ON_MESSAGE(OCM_CTLCOLORBTN, xxx)

instead.
0
 

Author Comment

by:edsont
ID: 1320275
I've already tried using ON_MESSAGE(OCM_CTLCOLORBTN, xxx) but
that solution didn't work in my case.

Could it be caused by the options I've checked in ActiveX ControlWizard ?

    Normal features I've checked:

         [ ] Activates when visible
         [x] Invisible at runtime
         [ ] Available in "Insert Object" dialog
         [ ] Has an "About" box
         [x] Acts as a simple frame control

    Advanced ActiveX enhancements:

         [x] Windowless activation
         [ ] <Other options are unchecked>

If the OCM_CTLCOLORBTN isn't arriving to my ActiveX Control because of the options I've checked, what could I do to fix the problem ?

Regards.

0
 

Author Comment

by:edsont
ID: 1320276
Adjusted points to 150
0
 
LVL 8

Accepted Solution

by:
Answers2000 earned 150 total points
ID: 1320277
You can't do this because WM_CTLCOLOR messages are actually sent to the parent of the control (in the app rather than the ActiveX) and then under normal circumstances reflected.

Get round this by using a stock property in the ActiveX control you develop to control the color of display.
0
 

Author Comment

by:edsont
ID: 1320278
Answers2000,

Could you give an example of your proposed solution ?

Regards.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 54
Replacement selected text 2 67
Prevent this page from creating additional dialogs. 3 726
method notes when mouse over in eclipse 5 90
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question