VB 托盘有关问题

VB 托盘问题
网上下载了一些托盘的例子,也包括老马的托盘例子,发现了一个通病

请教:
     右键系统托盘弹出菜单后,如果没有选择菜单中的某项,弹出的菜单是不会关闭的,非要选择菜单中某项,弹窗的菜单才关闭

     其他程序的托盘,右键弹出菜单若在菜单区域外点击一下,菜单都会消失,请问这是如何实现的?
VB托盘

------解决方案--------------------
我这个保证没有你说的通病!
http://download.csdn.net/detail/zhao4zhong1/570264
SetForegroundWindow
The SetForegroundWindow function puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user. The system assigns a slightly higher priority to the thread that created the foreground window than it does to other threads. 

BOOL SetForegroundWindow(
  HWND hWnd   // handle to window to bring to foreground
);
 
Parameters
hWnd 
Handle to the window that should be activated and brought to the foreground. 
Return Values
If the window was brought to the foreground, the return value is nonzero.

If the window was not brought to the foreground, the return value is zero. 

Remarks
The foreground window is the window at the top of the Z order. It is the window that the user is working with. In a preemptive multitasking environment, you should generally let the user control which window is the foreground window. 

Windows NT 5.0 and later: An application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call theFlashWindowEx function to notify the user.