我想问的是,
本来这个网页里有一个编辑框,供用户输入数据使用,没有集成在我的程序的时候,可以输入换行。可在我的程序里浏览这个网页时候,输入数据却无法换行,不知道是什么原因。
Q:请问如何传递回车消息给CWebBrowser2控件??现在是页面里面不响应回车
A:如果是回车的话不调用CDialog::PretranslateMessage,调用CWnd::
This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
--------------------------------------------------------------------------------
WebBrowser Keystroke Problems
lot of people have noticed that when they're hosting the WebBrowser control in MFC, ATL, or standard C++ applications, they sometimes run into trouble with certain keys. These keystroke problems usually occur when typing into intrinsic controls such as text boxes that reside on Web pages loaded by the WebBrowser control. Usually these keys are accelerator keys such as Backspace, Delete, and Tab. The problem is that the intrinsic controls on a Web page do not automatically receive these accelerator keys. When the WebBrowser control receives an accelerator key message, it does not automatically pass it to child controls on a Web page. Therefore, you must somehow let the WebBrowser control know that it should pass these messages to controls on your Web page. The solution is always the same whether you are hosting the control in MFC, ATL, or standard C++: call the TranslateAcclerator method of the IOleInPlaceActiveObject interface that is implemented by the WebBrowser control. But where and how you should do this is often unclear. Let's see how to work around keystroke problems in MFC, ATL, and standard C++ applications that are hosting the WebBrowser control.
MFC Dialogs
You can create three types of applications in MFC: dialog-based, single-document interface (SDI), and multiple-document interface (MDI). Each type requires a different solution to the keystroke problems.
When hosting the WebBrowser control in an MFC dialog-based application, the TranslateAccelerator method is automatically called for you, so you don't run into these problems with keystrokes. But understanding how MFC works when you are hosting the WebBrowser control in a dialog-based application will help you diagnose and solve problems with keystrokes in other situations.
In an MFC application, the Windows® message pump is managed for you. In a dialog-based application, a method called IsDialogMessage is invoked each time a message enters the loop. Among other things, this function will call TranslateAccelerator for any controls in the dialog. IsDialogMessage will pass the MSG structure that was received from a call to the GetMessage function in the message pump to the TranslateAccelerator method. MFC does this by creating an instance of a class called COccManager that manages all the OLE controls on your dialog. The IsDialogMessage method is a member of the COccManager class.
The IsDialogMessage method first gets a handle to the window that has the focus. If this window is a c