已知一个窗体的句柄(frmhandle),如果取得它上面一个标题为“确定”的按扭的句柄。

解决方案 »

  1.   

    FindwindowEX(frmhandle,0,nil,'确定'); 返回的就是一个按扭的句柄。
      

  2.   

    用WindowFormPoint也可以。
    var
      vHandle:THandle;
      vPoint:TPoint;
    begin
      GetCursorPos(vPoint);
      vHandle:=WindowFromPoint(vPoint);
      if vHandle<>0 then
      begin
      end;
      

  3.   

    var
      vHandle:THandle;
      vPoint:TPoint;
    begin
      GetCursorPos(vPoint);
      vHandle:=WindowFromPoint(vPoint);
      if vHandle<>0 then
      begin
      end;
      

  4.   

    FindwindowEX (在windowNT下不支持)
      

  5.   

    怎么用GetDlgItem方法来定位?……………………
      

  6.   

    FindwindowEX(frmhandle,0,'button','确定');
      

  7.   

    用WindowFormPoint这个API就可以了,他的作用就是获取鼠标当前位置控件的句柄
      

  8.   

    获取当前鼠标位置的类名和句柄
    procedure TFormMain.Timer1Timer(Sender: TObject);
    var
      p:tpoint;
      curwin:longint;
      Parwin:longint;
      text,textp:array[0..255] of Char;
    begin
      getcursorpos(p);//得到当前鼠标指针的在屏幕上的坐标
      curwin:=windowfrompoint(p);// 获得窗口句柄 
      getclassname(curwin,text,255);//取得窗体的类名
      parWin:=GetParent(curwin);//获得父窗体句柄
      getclassname(parWin,textp,255);//取得父窗体的类名
      Label1.caption:=inttostr(curwin)+':'+text+'  parent:'+inttostr(parWin)+':'+textp;
    end;
      

  9.   

    同意  hottey(点亮心灵)(基础补习中)
    用FindWindowEx ...
      

  10.   


    支持hottey(点亮心灵)(基础补习中)
      

  11.   

    FindwindowEX(MainFrm.Handle,0,nil,'确定&Y'); OK