c++ - How to correctly access ATL control from ATL Dialog? -
i have msvc 2010 solution contains 2 projects:
- atl dll project, contains dhtml control (named dhtmlcontrol, pretty built wizard). think have placed control second project though.
- atl exe project, contains main dialog (cmaindialog), created wizard.
i have managed add dhtmlcontrol dialog:
- added dhtmlcontrol toolbox
- dragged onto main dialog in resource view
- removed dhtmlcontrol toolbox (to avoid access denial on build)
however, problem not know how use control!
assuming in scope of maindialog, in:
lresult cmaindialog::oninitdialog(uint umsg, wparam wparam, lparam lparam, bool& bhandled)
what right way invoke dhtmlcontrol's methods? say, navigate url or after button on main dialog pressed.
how can pointer/reference dhtmlcontrol (cdhtmlcontrol? idhtmlcontrol?) being inside of cmaindialog class?
sorry if sounds bit messy struggling atl.
thank you.
include generated _i.h dialog's header (do not include actual control's header - not meant included).
then use this:
ccomptr<idhtmlcontrol> ptr; hresult hr = getdlgcontrol(idc_dhtml_control, iid_idhtmlcontrol, (void**)&ptr); bstr url = sysallocstring(l"http://example.com/"); // call control's prop method ptr->put_url(url); sysfreestring(url);
Comments
Post a Comment