Solved

Sending mouse events to an ActiveX control

Posted on 2003-11-19
5
378 Views
Last Modified: 2013-11-20
Hi

I have an MFC Dialog application with a single Dialog. In it is a Flash ActiveX control. I am using SetCapture and ReleaseCapture to send the mouse events to the dialog rather than to the control when the mouse is over it, and this is working fine.

What I need to do now is capture the WM_RBUTTONDOWN messages and deal with them myslef, but send the WM_LBUTTONDOWN and WM_MOUSEMOVE messages onto the control. I guess I need to use PostMessage to do this, but i don't know how to direct it to the control.

I am new to MFC programming and still trying to get to grips with how to reference things, but it appears to me that the whole dialog is one class, with one instance name and none of its contents (including the Flash control) have any instance names. How do I reference it?

Thanks for your help
0
Comment
Question by:completecontrol
  • 3
  • 2
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 9779703
Use the SDK version where you supply the HWND of the window to receive the message
 ::PostMessage(hWnd_FLASHCONTROL,...)
0
 

Author Comment

by:completecontrol
ID: 9779915
How can I get the hWnd for it.

This might be a stupid question. I have done Win32 C programming before and there are window handles flying around all over the place. But in MFC it seems like they are purposely hidden from you.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 200 total points
ID: 9779982
I don't know how you have put this Flash control on your dialog so the following is a bit of guesswork.

GetDlgItem(IDC_FLASH)->GetSafeHwnd();

0
 

Author Comment

by:completecontrol
ID: 9780724
I've done it now. There is no need to use handles here, I used:

CWnd *FlashContolWnd = GetDlgItem(IDC_FLASH);
FlashControlWnd->PostMessage(WM_MOUSEMOVE, ...);
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 9781001
The other way with the handles is also useful for posting to windows in other apps.
Glad you got it sorted.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now