delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
getwindowrect不能正确使用,请指教 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiAPI/html/delphi_20061116121147219.html
ha:hwnd;  
      i:integer;  
      begin  
  ha:=findwindow(nil,pchar(excelapplication1.caption));  
  showmessage(inttostr(ha));  
  getwindowrect(ha,posi);  
  showmessage(inttostr(posi.TopLeft.X));  
  为何   posi.left,posi.topleft.x   的值均为零,不能正确返回excel窗口的正确位置,  
  不知道代码错在那里?  
   
 

procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      Rect:TRect;  
  begin  
      GetWindowRect(Handle,Rect);  
      ShowMessage(inttostr(Rect.Left));  
  end;  
   
  我这个代码是可以的,有可能是你的posi没有定义成TRect;

posted on 2009-02-03 09:50 delphi2007 阅读(765) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。