c++ - How to implement Find-on-Page command in MFC web browser control with pre-filled search word? -
i'm using mfc web browser control in dialog-based mfc project display html content , trying make show "find on page" dialog window search word pre-selected in it. (what you'd if hit ctrl+f in ie web browser.)
if following find dialog shown ok, doesn't seem support way pre-fill search word:
iwebbrowser2* pwebbrowser = null; lpunknown unknown = m_browser.getcontrolunknown(); unknown->queryinterface(iid_iwebbrowser2,(void **)&pwebbrowser); if(pwebbrowser) { hresult hr; ccomvariant varnull; if(succeeded(hr = pwebbrowser->execwb(olecmdid_find, olecmdexecopt_promptuser, &varnull, &varnull))) { //success! } pwebbrowser->release(); } if(unknown) { unknown->release(); }
i found this msdn page, says:
olecmdid_showfind tells receiver show find dialog box. takes vt_dispatch input param.
so evidently there's find command olecmdid_showfind
id, can't seem make work. don't understand vt_dispatch
input param either? when try -- total shot in dark due lack of documentation:
ccomvariant var1 = l"pre-filled search word 1", var2 = l"pre-filled search word 2"; hr = pwebbrowser->execwb(olecmdid_showfind, olecmdexecopt_dodefault, &var1, &var2);
but hr=0x80040100
or "trying revoke drop target has not been registered"
any idea how make work?
Comments
Post a Comment