Solved

Sending mouse events to an ActiveX control

Posted on 2003-11-19
5
389 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

828 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