mfc >> ActiveX Events / Messages
by ashishluvin » Thu, 23 Mar 2006 18:59:35 GMT
I am having a dialog box and a activex control on it....I want to
handle SCROLL messages for activex I just want to know How can I handle
standard scroll events(e.g. WM_HSCROLL) for my activex from my code ??
>From some searching I got I need BEGIN_EVENTSINK_MAP ...
END_EVENTSINK_MAP
BEGIN_EVENTSINK_MAP()
ON_EVENT( <========how to handle
standard WM_HSCROLL here ???
END_EVENTSINK_MAP()
Do my activex control need to manually fire this standard messages too
?
Thanx
Ashish
Similar Threads
1. activex in activex event handling - CSharp/C#
2. Activex control events not firing or ActiveX composite control not listening
I'm new to ATL so please bear with me.
I'm using VS2005. I generated a composite ActiveX control to host
ActiveX controls. It will host two or more ActiveX controls. I put the
ActiveX controls on the dialog at design time. I've also put a few
standard buttons.
Here's a clip of the generated class def:
class ATL_NO_VTABLE CTest5Ctrl :
....
public CComCompositeControl<CTest5Ctrl>,
public IDispEventImpl<IDC_MMHITIMERX1,CTest5Ctrl>,
public IDispEventImpl<IDC_MMWAVERECORDERX1,CTest5Ctrl>
{...}
I used GetDlgItem() and AtlAxGetControl() to get smart pointers around
the ActiveX controls. I used CAxWindow.Attach() and GetDlgItem() to get
wrappers around the buttons. I did all of this in OnInitDialog -- (side
question: should I be doing this in OnInPlaceActivate?). This, I'm
guessing, doesn't really pertain to my problem, but I put it out there.
I added event handlers for the buttons which then call some methods on
the ActiveX controls. For ex:
LRESULT CTest5Ctrl::OnBnClickedBtnRecord(WORD /*wNotifyCode*/, WORD
/*wID*/, HWND /*hWndCtl*/, BOOL& bHandled)
{
HRESULT r = m_spWaveRecorder->Recording(); // ActiveX control
bHandled = TRUE;
return 0;
}
Calling Recording() should fire a OnStart event. I added an OnStart
handler. Here's the generated sink map entry and my handler.
BEGIN_SINK_MAP(CTest5Ctrl)
SINK_ENTRY(IDC_MMWAVERECORDERX1, 1, OnStartMmwaverecorderx1)
END_SINK_MAP()
void __stdcall CTest5Ctrl::OnStartMmwaverecorderx1()
{
// I should get here
}
Now I get the button events. I can step into them and call methods on
the ActiveX controls. I put breakpoints in all of my ActiveX control
event handlers and none of them are entered. I put breakpoints in
BEGIN_SINK_MAP and they are entered upon startup.
I tried Spy++ and I don't see events being fired from the controls but
being new to ATL and Spy++, I don't know if what I'm seeing is normal
or not. I see other events such as mouse movements and clicks, but
nothing unique to the controls.
I have no idea why I'm not getting events from the ActiveX controls.
Any ideas?
Gary F.
3. Getting activex control event from ActiveX control.
4. WM_HELP message and ActiveX control
5. Windows message flow from container to Activex control
6. Activex control containment message reflection
Is there a way to get ATL ActiveX control containment to reflect
specific messages to the ActiveX control itself?
My problem is that when I send WM_SETTEXT and WM_GETTEXT message to the
AtlAxWinLic80 window I would like it to reflect the message to the
ActiveX control itself. Is there a way to do that?
7. Processing ActiveX-Window-Messages In The Client
8. Message Handling in ActiveX Control
I have developed a new ATL COM object.I have added a WM_LBUTTONDOWN
handler to the control. The WM_LBUTTONDOWN is not firing continuously
when the Mouse Leftbutton is pressed down. I would like to know what
is happening.
Regards,
D.Ramesh