试试:Declare Function GetWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Declare Function GetDesktopWindow Lib "user32.dll" () As Long const GW_HWNDFIRST = 0Sub GetWindow()    deskhwnd = GetDesktopWindow()  
    YourWanthWnd = GetWindow (deskhwnd ,GW_HWNDFIRST)
End Sub' 如果不行, 就试试 
  GetTopWindow(deskhwnd)

解决方案 »

  1.   

    9494,用GetForegroundWindow 
    GetForegroundWindow VB声明 
    Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Long 
    说明 
    获得前台窗口的句柄。这里的“前台窗口”是指前台应用程序的活动窗口 
    返回值 
    Long,前台窗口的句柄 
    注解 
    windows nt支持多个桌面,它们相互间是独立的。每个桌面都有自己的前台窗口
     
      

  2.   

    各位高手,多谢及时回应。不过getdesktopwindow 和GetForegroundWindow好象还是有点区别,从MSDN来看,好象还是GetForegroundWindow更适合我的要求。