if me.hwnd <>GetForegroundWindow() then
else
endif
GetForegroundWindow VB声明 
Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Long 
说明 
获得前台窗口的句柄。这里的“前台窗口”是指前台应用程序的活动窗口 
返回值 
Long,前台窗口的句柄 
注解 
windows nt支持多个桌面,它们相互间是独立的。每个桌面都有自己的前台窗口
 
SetForegroundWindow VB声明 
Declare Function SetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long 
说明 
将窗口设为系统的前台窗口。这个函数可用于改变用户目前正在操作的应用程序 
返回值 
Long,非零表示成功,零表示失败。会设置GetLastError 
参数表 
参数 类型及说明 
hwnd Long,带到前台的窗口 
注解 
不应随便使用它,因为一旦程序突然从后台进入前台,可能会使用户产生迷惑