Solved

How to pass WM_CTLCOLORBTN to a ActiveX Control

Posted on 1998-08-05
5
337 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 67
Perl Awk Need Help 3 128
Define unique primary key 9 95
java ^ examples 8 69
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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