[prev in list] [next in list] [prev in thread] [next in thread]
List: ms-atl
Subject: Re: Why are activex events not called?
From: Chris Sells <csells () SELLSBROTHERS ! COM>
Date: 1998-12-31 16:56:42
[Download RAW message or body]
You didn't call AtlAdviseSinkMap(this, true) in WM_INITDIALOG or
AtlAdviseSinkMap(this, false) in WM_DESTROY.
Chris Sells
http://www.sellsbrothers.com
> -----Original Message-----
> From: ATL - Active Template Library [mailto:ATL@DISCUSS.MICROSOFT.COM]On
> Behalf Of Itay Lotan
> Sent: Thursday, December 31, 1998 5:10 AM
> To: ATL@DISCUSS.MICROSOFT.COM
> Subject: Why are activex events not called?
>
>
> I'm using VC++ 6.0 and ATL 3.0
> I'm writing a simle application that opens a dialog based on the ATL class
> CAxDialogImpl. To do that I use the "New Atl Object" wizard and choose a
> dialog. Then I add a the Calendar object onto the dialog and using the
> wizard add handlers for three events generated by the control. To
> my dismay,
> when I run the application and try to activate any of these events, my
> handlers are never called. Does anybody know what I did wrong?
> Here is my code for the dialog:
>
> class CCalander :
> public CAxDialogImpl<CCalander>,
> public IDispEventImpl<IDC_CALENDAR1, CCalander>
> {
> public:
> CCalander()
> {
> }
>
> ~CCalander()
> {
> }
>
> enum { IDD = IDD_CALANDER };
>
> BEGIN_MSG_MAP(CCalander)
> MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
> COMMAND_ID_HANDLER(IDOK, OnOK)
> COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
> END_MSG_MAP()
>
> LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM
> lParam, BOOL&
> bHandled)
> {
> return 1; // Let the system set the focus
> }
>
> LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
> bHandled)
> {
> EndDialog(wID);
> return 0;
> }
>
> LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
> bHandled)
> {
> EndDialog(wID);
> return 0;
> }
> VOID __stdcall OnClickCalendar1()
> {
> MessageBox("click");
> }
> VOID __stdcall OnDblClickCalendar1()
> {
> MessageBox("dblclick");
> }
> VOID __stdcall OnKeyPressCalendar1(SHORT * KeyAscii)
> {
> MessageBox("Keypressed");
> }
> public :
>
> BEGIN_SINK_MAP(CCalander)
> //Make sure the Event Handlers have __stdcall calling convention
> SINK_ENTRY(IDC_CALENDAR1, DISPID_CLICK, OnClickCalendar1)
> SINK_ENTRY(IDC_CALENDAR1, DISPID_DBLCLICK, OnDblClickCalendar1)
> SINK_ENTRY(IDC_CALENDAR1, DISPID_KEYPRESS, OnKeyPressCalendar1)
> END_SINK_MAP()
>
> };
>
> TIA, Itay
>
> ----------------------------------------------------------------
> Users Guide http://www.microsoft.com/workshop/essentials/mail.asp
> contains important info including how to unsubscribe. Save time, search
> the archives at http://discuss.microsoft.com/archives/index.html
>
----------------------------------------------------------------
Users Guide http://www.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe. Save time, search
the archives at http://discuss.microsoft.com/archives/index.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic