I'm trying to port a C++/MFC application that uses an embedded Internet Explorer control to a new device running Windows CE 6.0. The browser control is successfully created and can display pages and follow links, but submitting an HTML form does not work. Nothing happens when I press the submit button, either on local pages or web sites like MSN, Yahoo or Google. I've tried running the application in the debugger, but I don't get any exception and the 'BeforeNavigate2" callback is never invoked.
I looked at the two Internet Explorer sample applications in the Windows CE 6.0 Platform Builder under the %WINCEROOT%\Public\Ie\Oak directory to see if I was creating the control correctly. The IESIMPLE example is able to submit forms, but the IESAMPLE does not. The difference is that IESIMPLE always calls CoInitializeEx with COINIT_MULTITHREADED and IESAMPLE calls it with COINIT_APARTMENTTHREADED if the device supports DCOM (which the device I'm using does). For some reason, submitting HTML forms only works in a multi-threaded apartment. Has anyone else seen this problem or know how to work around it? I've tried searching the MSDN forums and web, but haven't found any references to anything like this. Maybe it's specific to how the specific device I'm using is configured. I've used an embedded web browser control in both Windows Mobile and XP applications for years (in a single threaded COM
apartment) and haven't had a problem before. The new device I'm trying to port to is the WebDT 430 (
www.dtresearch.com/product/dt430/index.htm)
and I'm using Visual Studio 2008 and the SDK I downloaded from their web site.
Does anyone have any ideas for how to work around this problem? I'm not familiar with all the COM internals or different apartment models, but I've read that MFC needs to be initialized as a single-threaded apartment so I can't just call CoInitializeEx with COINIT_MULTITHREADED at the beginning of my application. Does that mean I need to create a separate thread for just the web browser and try to marshall the interface between the browser thread and the MFC thread? Will the browser callbacks like BeforeNavigate2 and DocumentComplete work across threads?
Any help or ideas would be appreciated.