获取其他程序的控件句柄,怎么根据句柄获取控件visible和enable属性,需要用哪个api?

解决方案 »

  1.   

    Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Declare Function EnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
      

  2.   

    这个并不能简单的考虑吧?首先还得看你的是什么控件,可以考虑使用SetFocus来设置焦点成功与否来间接判断,成功了Enable为True,反之为False
      

  3.   

    Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Declare Function EnableWindow Lib "user32" Alias "EnableWindow" (ByVal hwnd As Long, ByVal fEnable As Long) As Long这两个函数是设置的,我要的是获取属性,不是设置属性
      

  4.   

    http://zhidao.baidu.com/question/99402828.html
      

  5.   

    Public Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
      

  6.   

    Private Declare Function IsWindowVisible Lib "user32" Alias "IsWindowVisible" (ByVal hwnd As Long) As Long
    Private Declare Function IsWindowEnabled Lib "user32" Alias "IsWindowEnabled" (ByVal hwnd As Long) As Long
      

  7.   

    dim nEnable as boolean,nVisible as boolean
    nEnable=(WS_DISABLED and GetWindowLong(hwnd,GWL_STYLE))
    nVisible=(WS_VISIBLE and GetWindowLong(hwnd,GWL_STYLE))自己试试临时打出来的 不知道有没笔误
      

  8.   

    返回非零值的话就是Visible或Enabled
    用if判断一下即可