如题~希望大家能帮帮小弟

解决方案 »

  1.   

    调用GetForegroundWindow得以得到前台窗口句柄若你是想知道某个窗体是否被其他窗体遮盖,那只能编程判断了:用EnumWindows枚举窗口,然后用GetWindowRect得到窗口尺寸,再用数学公式计算矩形是否相交
      

  2.   

    窗口句柄是Windows对窗口的编号
    每次窗口创建时,Windows会对其分配一个句柄
    调用GetWindowText可以得到窗口标题
    GetWindowText VB声明 
    Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long 
    说明 
    取得一个窗体的标题(caption)文字,或者一个控件的内容(在vb里使用:使用vb窗体或控件的caption或text属性) 
    返回值 
    Long,复制到lpString的字串长度;不包括空中止字符。会设置GetLastError 
    参数表 
    参数 类型及说明 
    hwnd Long,欲获取文字的那个窗口的句柄 
    lpString String,预定义的一个缓冲区,至少有cch+1个字符大小;随同窗口文字载入 
    cch Long,lpString缓冲区的长度 
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
    Private Sub Form_Activate()
        Dim MyStr As String
        'Create a buffer
        MyStr = String(GetWindowTextLength(Me.hwnd) + 1, Chr$(0))
        'Get the window's text
        GetWindowText Me.hwnd, MyStr, Len(MyStr)
        MsgBox MyStr
    End Sub