Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MSHTML autocomplete in ATL/C++, no .NET

Posted on 2004-11-01
3
Medium Priority
?
918 Views
Last Modified: 2013-11-25
When hosting the webbrowser control directly, autocomplete works just fine. When hosting the mshtml control directly, autocomplete does not seem to work. Anyone have an idea on what the host needs to do to get the mshtml control to use autocomplete on forms. I have set the host's IDocHostUIHandler's DocHostFlags to DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE and also fooled with OptionKeyPath, but haven't gotten anywhere. Another option might be to subclass the edit window in the document, implement my own autocomplete object, and use SHAutoComplete on the edit window. That seems like overkill though. Any help is appreciated. Thanks.
0
Comment
Question by:jweston1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Expert Comment

by:KurtVon
ID: 12473581
Hopefully someone else can give you a more definitive answer, but rather than leave you hanging, here's what I see:

---snip---
DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE
Internet Explorer 5 or later. This flag enables the AutoComplete feature for forms in the hosted browser. The Intelliforms feature is only turned on if the user has previously enabled it. If the user has turned the AutoComplete feature off for forms, it is off whether this flag is specified or not.
---snip---

So setting the flag is not going to do any good when the option is disabled, and you will need to make sure the option is active.  This tells me one of two things:

1) It is possible that the option is read by the program controlling the mshtml control.  In that case, when hosting the webbrowser control, the webbrowser control reads the option from the normal IE registry settings, but when your program runs the html control directly the option is read from a different location.  Not very likely, but possible.

2) More likely, the autocomplete feature is actually implemented in the webbrowser control and you are missing a (possibly undocumented) callback needed to do autocomplete.  If this is true then SHAutoComplete will probably not work either (give it a try to see if this is a possibility though, it can't hurt).

I suspect #2 mostly because the IDocHostUIHandler docs say that it enables WebBrowser control features, not mshtml control features.

Hope this helps.

0
 
LVL 3

Author Comment

by:jweston1
ID: 12480626
Thanks for your response.  The IDocHostUIHandler::GetOptionKeyPath is called by the mshtml control, and uses the default registry settings at HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer if the function returns S_FALSE or the key is NULL. My default settings already have autocomplete on, so I don't set a new OptionKeyPath. Also, the DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE flag works with the webbrowser control, but not with the mshtml control. As for SHAutoComplete, I realized I can't call it since the html edit box is not a window. So, I am thinking that the mshtml control doesn't support autocomplete.
0
 
LVL 11

Accepted Solution

by:
KurtVon earned 720 total points
ID: 12483548
Yeah, I knew #1 wasa long-shot, but it was pretty much the only way this was going to work easily.  IDocHostUIHandler2 does have a GetOverrideKeyPath, but if the correct location is being read there is no point in worrying about it.

There is probably an interface for the autocomplete callback that needs to be implemented.  I'm surprised it isn't handled in IDocHostUIHandler to be honest, since that is the interface that reports the capability.  I haven't been able to track down any documentation on it, though, so I suspect this is one of Microsoft's secret interfaces  you need to sign an NDA to find out about.  Certainly nothing obvious.

Sorry.  Maybe someone with insider information will pipe up.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question