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:

  1. added dhtmlcontrol toolbox
  2. dragged onto main dialog in resource view
  3. 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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -