Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to pass WM_CTLCOLORBTN to a ActiveX Control

Posted on 1998-08-05
5
Medium Priority
?
345 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

715 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