Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

[ENTER] key in WebBrowser

Title: [ENTER] key in WebBrowser Question: it has been a known bug in TWebBrowser for a long time Answer: and this component fixes that and many other issues http://www.euromind.com/iedelphi/EmbeddedWb.htm however, if you are like many, you don't want to install third party components for simple bugs, so here's a simple workaround (dirty solution) for this bug set the KeyPreview to True in your form, then in the FormKeyPress put procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if (Key=#13) then begin Keybd_Event(VK_LCONTROL, 0, 0, 0); //Ctrl key down Keybd_Event(Ord('M'), MapVirtualKey(Ord('M'), 0), 0, 0); // 'M' key down Keybd_Event(Ord('M'), MapVirtualKey(Ord('M'), 0), KEYEVENTF_KEYUP, 0); // 'M' Key up Keybd_Event(VK_LCONTROL, 0, KEYEVENTF_KEYUP, 0); // Ctrl key up end end; that's it, there you have a WebBrowser with the Enter key enabled salu2