Private Declare Function FindWindow& Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName$, ByVal lpWindowName$) Private Declare Function FindWindowEx& Lib "user32" Alias _ "FindWindowExA" (ByVal hWndParent&, ByVal hWndChildAfter&, _ ByVal lpClassName$, ByVal lpWindowName$) Public Function ActiveDesktop() As Boolean Dim tmpLong& tmpLong = FindWindow("Progman", vbNullString) tmpLong = FindWindowEx(tmpLong, 0&, "SHELLDLL_DefView", vbNullString) tmpLong = FindWindowEx(tmpLong, 0&, "Internet Explorer_Server", _ vbNullString) If tmpLong > 0 Then ActiveDesktop = True Else ActiveDesktop = False End If End Function |