您现在的位置:首页 >> VCL >> VCL >> 内容

Delphi中解决MDI的DLL子窗体中的Tab键下移控件问题

时间:2011/9/3 16:24:21 点击:

  核心提示:关键代码:functionTForm1.GetSysFocus:Integer; var hOtherWin,OtherThreadID,hFocusWin:integer; begin hOther...

关键代码:

function   TForm1.GetSysFocus:   Integer;  
  var  
      hOtherWin,OtherThreadID,hFocusWin:integer;  
  begin  
      hOtherWin:=GetForegroundWindow;  
      OtherThreadID:=GetWindowThreadProcessID(hOtherWin,nil);  
      if   AttachThreadInput(GetcurrentThreadID,OtherThreadID,True)   then  
      begin  
          hFocusWin:=GetFocus;  
          result:=GetFocus;  
      if   HFocusWin<>0   then  
      try  
      //SendMessage(GetFocus,WM_COPY,0,0);//书上是这么写的  
      finally  
          AttachThreadInput(GetcurrentThreadID,OtherThreadID,False);  
      end;  
      end  
      else   result:=GetFocus;  
  end;   //这段代码是得到当前正在输入控件的Handle

全部代码已经打包



迅雷专用高速下载

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号