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

x
?
Solved

Sending mouse events to an ActiveX control

Posted on 2003-11-19
5
Medium Priority
?
407 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
[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
  • 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 600 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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