Web Browser Control에서 Enter키 먹게 하기 | |||
| |||
interface uses ActiveX; // 추가 type TForm1 = class(TForm) Button1: TButton; ApplicationEvents1: TApplicationEvents; // <- 추가 WebBrowser1: TWebBrowser; procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); procedure FormShow(Sender: TObject); private { Private declarations } public { Public declarations } FOleInPlaceActiveObject: IOleInPlaceActiveObject; // <- 추가 end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean); var iOIPAO: IOleInPlaceActiveObject; Dispatch: IDispatch; begin { exit if we don't get back a webbrowser object } if (WebBrowser1 = nil) then begin Handled := False; Exit; end; Handled := (IsDialogMessage(WebBrowser1.Handle, Msg) = True); if (Handled) and (not WebBrowser1.Busy) then begin if FOleInPlaceActiveObject = nil then begin Dispatch := WebBrowser1.Application; if Dispatch <> nil then begin Dispatch.QueryInterface (IOleInPlaceActiveObject, iOIPAO); if iOIPAO <> nil then FOleInPlaceActiveObject := iOIPAO; end; end; if FOleInPlaceActiveObject <> nil then if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and ((Msg.wParam = VK_BACK) or (Msg.wParam = VK_LEFT) or (Msg.wParam = VK_RIGHT)) then //nothing - do not pass on Backspace, Left or Right arrows else FOleInPlaceActiveObject.TranslateAccelerator (Msg); end; end; procedure TForm1.FormShow(Sender: TObject); begin WebBrowser1.Navigate( 'http://yahoo.co.kr'); end; end. Tags: 윈도우즈 | |||
| |||
| |||
로그인을 하시면 댓글을 등록 할 수 있습니다. |