如何实现时刻检测ppt和word是否被激活

怎么实现时刻检测ppt和word是否被激活
最近遇到了一个问题,自己做的一个程序项目要判断ppt和word的状态,简单的说就是如果现在处于ppt或者word的编辑状态(能往上敲字),一个控件就激活,否则此控件就不能用,因为要自动监测,我想应该用到timer,但不知道具体怎么实现,用什么函数?
哪位高人帮我一下,谢谢

------解决方案--------------------
Public Declare Function FindWindow Lib "user32 " Alias "FindWindowA " (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Declare Function FindWindowEx Lib "user32 " Alias "FindWindowExA " (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Dim hW As Long

hW = FindWindow( "OpusApp ", vbNullString)
If hW Then MsgBox "WinWord.exe is running "

hW = FindWindow( "PP11FrameClass ", vbNullString)
If hW Then MsgBox "POWERPNT.exe is running "

------解决方案--------------------
2 OpusApp和PP11FrameClass这两个参数你是怎么得到的?
你用SPY+就可得到。
Excel Class is "XLMAIN "
Word Class is "OpusApp "
Powerpoint Class is "PP11FrameClass "
Access Class is "OMain "
Outlook Class is "rctrl_renwnd32 "