Webbrowser加载Flash后方向键失效问题(用到了OLE接口,没有被处理就转发,够复杂的)

原文:http://blog.csdn.net/dropme/article/details/6253528

 

窗体上放一个ApplicationEvent控件,OnMessage事件中这么写

 

[delphi]  view plain  copy
 
 在CODE上查看代码片
  1. uses  
  2.   ActiveX;  
  3.   
  4. procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);  
  5. const  
  6.   StdKeys = [VK_TAB, VK_RETURN, VK_BACK]; { standard keys }  
  7.   ExtKeys = [VK_DELETE, VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN]; { extended keys }  
  8.   fExtended = $01000000; { extended key flag }  
  9. var  
  10.   CurrentEWB: TEmbeddedWB;  
  11. begin  
  12.   Handled := False;  
  13.   CurrentEWB := EmbeddedWB1;  
  14.   if Assigned(CurrentEWB) then  
  15.     if IsChild(CurrentEWB.Handle, Msg.Hwnd) then  
  16.     begin  
  17.       Handled := (IsDialogMessage(CurrentEWB.Handle, Msg) = True);  
  18.       if Handled and not CurrentEWB.Busy then  
  19.         if ((Msg.Message >= WM_KEYFIRST) and (Msg.Message <= WM_KEYLAST)) and  
  20.           ((Msg.wParam in StdKeys) or (GetKeyState(VK_CONTROL) < 0) or (Msg.wParam in ExtKeys) and  
  21.           ((Msg.lParam and fExtended) = fExtended)) then  
  22.         begin  
  23.           Handled := (CurrentEWB.Application as IOleInPlaceActiveObject).TranslateAccelerator(Msg) = S_OK;  
  24.           if not Handled then  
  25.           begin  
  26.             Handled := True;  
  27.             TranslateMessage(Msg);  
  28.             DispatchMessage(Msg);  
  29.           end;  
  30.         end;  
  31.     end;  
  32. end;  

http://blog.csdn.net/aqtata/article/details/8669286

你可能感兴趣的:(Webbrowser加载Flash后方向键失效问题(用到了OLE接口,没有被处理就转发,够复杂的))