cjserio

Hello,

I've created an ATL Smart Device project, and added one ATL Simple Object (CKeyReceiver) with Connection Point support. I've added one method to the event interface (ButtonPushed) and i've added the connection point to my CKeyReceiver class. It autogenerates a proxy and fills in the connection point code just fine.

I've also modified my CKeyReceiver class so that it derives from IProvideClassInfo2.

The object loads fine on an HTML page, but the connection point does not work. If i step through the autogenerated code that fires the event, it never fires it because m_vec is 0. So i stepped through a lot of the ATL code and it seems that IConnectionPointImpl::Advise is getting called but is not returning succesfully. It makes an attempt to QueryInterface and returns E_NOINTERFACE. The interfaces it's querying for are IPropertyNotifySink and IDispatch.

This exact same code runs great on the PC. If i step through the Advise function there, it queries for my event interface and finds it properly. So why doesn't this work on Windows CE 5.0

I've also tried making a full blown ActiveX control with connection points on Windows CE 5.0 and that code doesn't work either. I've tried deriving from IObjectSite as well with no luck.

I can post code samples if necessary.

Thanks,
Chris


Re: Smart Devices Native C++ Development (VS2005 bug?) ActiveX Control with connection points not working in VS2005 with Windows CE 5.0

cjserio

If anyone has or can make a very simple ActiveX control for Windows CE 5.0 using VS2005 that demonstrates a connection point working properly, that would be immensely useful to me. It only takes a minute to make. Here are the steps that i took to make mine but obviously it's not working properly...

1) Create a new ¡°ATL Smart Device Project¡± and name it MyKeyReceiverProj. It¡¯s a DLL without MFC support and without a merged proxy/stub.

2) In the class explorer, add a new ¡°ATL Simple Object¡± called KeyReceiver. Be sure to enable support for Connection Points. The rest of the settings were default.

3) In the class explorer, expand the MyKeyReceiverProjLib TypeLib to find the _IKeyReceiverEvents interface.

4) Add a new method to the _IKeyReceiverEvents interface called ButtonPressed. It takes a LONG named button.

5) In the class explorer, right click on the CKeyReceiver class and select ¡°Add Connection Point.¡± Pick the _IKeyReceiverEvents interface and click finish

6) From here I changed the CKeyReceiver class def so that it also derives from public IProvideClassInfo2Impl<&CLSID_KeyReceiver, &__uuidof(_IKeyReceiverEvents), &LIBID_MyKeyReceiverProjLib>,

7) Here I added COM_INTERFACE_ENTRY(IProvideClassInfo) and COM_INTERFACE_ENTRY(IProvideClassInfo2) to the COM_MAP.

8) Make an html page that loads this ActiveX control and in the javascript do document.getElementById("MyActiveXObj").attachEvent('ButtonPressed', _SomeJSFunction);

9) Now attach the debugger and set a breakpoint on line 5702 of atlcom.h. It's in the function IConnectionPointImpl::Advise. Load up the website with the activex. Your breakpoint should be hit...Does yours return E_NOINTERFACE This is where my ActiveX is failing.

Anyone have any ideas why this is happening or how to fix it

Thanks,
Chris




Re: Smart Devices Native C++ Development (VS2005 bug?) ActiveX Control with connection points not working in VS2005 with Windows CE 5.0

cjserio

After more extensive reading, it seems this may be an issue with the lack of an OLE Automation Marshaler in Windows CE. What i'm confused about though if that's true (and it's just a speculation) is why it would matter in this case. My ActiveX is really a DLL that's being loaded by Internet Explorer so there's no cross-process communication that I know of.

Opinions

Thanks,
Chris




Re: Smart Devices Native C++ Development (VS2005 bug?) ActiveX Control with connection points not working in VS2005 with Windows CE 5.0

cjserio

Well after banging my head against the wall for a few days, it seems that the solution is to set the ATL Simple Object to threading type "Single" when using the wizard to create the object. By default, it's set to Apartment threaded however numerous sources on the web say that Windows CE does not support apartment threaded COM objects which makes that quite a silly default selection.

Can anyone confirm that this is actually a bug




Re: Smart Devices Native C++ Development (VS2005 bug?) ActiveX Control with connection points not working in VS2005 with Windows CE 5.0

avinash prasad

I didn't understand from your description that you were using single threading on my first reading. CE can support threading models other than free and single for DCOM images ( see http://msdn2.microsoft.com/en-us/library/ms905835.aspx for more infromation ), so its not entirely true that all options in the wizard are useless. But I shall agree with the fact as minimal COM support is what you get on most of the devices like PPC and SP, we should have a better default.

I will send this information to the concerned guys.

Thanks