Archived

This topic is now archived and is closed to further replies.

ATL help

This topic is 5649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im trying to put an active x control into an ATL project. Ive started by creating a CAxWindow and then CAxWindow::CreatControlEx(). All is going fine, my control loads up and displays. I now need to know where to go from here to actually use the control, i.e. invoke its methods and recieve events. My problem is I need to be able to load in different controls at run time so I cannot set up for example an Event_Sink_Map or #import the library because, well it will be different depending on what icontrol needs to be used. Ive managed to do this with mfc but it gives you a class COleClientItem that you create the control with and Invoke() its methods. Is there anything like that for ATL or if not how do I go about doing this manually? Thanks for your time and any input is appreciated. p.s. I have tried to search for info on this but its quite difficult because most of the info for ATL is about creating the controls not the clients and the rest is about loading and using a control that is hardcoded at develop time.

Share this post


Link to post
Share on other sites
Unfortunately, I don''t have any reference material with me right now but if memory serves me CAxWindow has a QueryInterface method you can use to get the interfaces your after.

Share this post


Link to post
Share on other sites
Thanks for the reply.

I can get all the info I need about the control at runtime by Getting the IUnknown* of the control and then use
QueryInterface() to get the events I need to handle and the methods I "should" be able to invoke. However I dont know how to then invoke those methods ive found or how to set up the event sink at run time.

It seems pretty easy if you embed the control at develop time, you just derive the window class from CAxWindow, IPropertyNotifySink and IDispEventImpl, using the known ID of the events interface and then set up the Sink_Map using the known ID of the event interface.

However thats my problem I dont know the ID of the event interface until the control is loaded so I cant create an instance of IDispEventImpl or create the sink_map until its loaded and yet it seems there is no way to do this dynamically with ATL

Share this post


Link to post
Share on other sites
Yeah I figured that was the case, oh well i think ill stick to mfc version, the only reason I wanted to try and do it in atl is so that i dont have a ton of stuff that i dont need (like with all the mfc parts).

Thanks for the help

Share this post


Link to post
Share on other sites