MS Windows- Main window no response when show menu on a tray notify icon(use a hidden window to proc


I implemented an class, this class will show an tray icon. to handle the message from the icon, I have to create a hidden window.

Eevery thing works fine, except if You click outside of the icon, icon will not disappear. I have fixed this by adding code below:

SetForegroundWindow(message-only-hiden-window) // added TrackPopupMenu()

RESOLUTION:To correct the first behavior, you need to make the current window the foreground window before calling TrackPopupMenu or TrackPopupMenuEx.

Now I get the expect result: the menu can disappear if you click outside of the tray icon.

The problem is now, after the call of SetForegroundWindow(message-only-hiden-window) the main app window will no responding(cannot resize move) I can see the main window actually get those messages in spy++. Keep this the mind if no call on SetForegroundWindow(message-only-hiden-window). Fine. Except the menu will not disappear.

Anyone has experience on similar situation? How do you implement an tray icon which has no foreground window at all?

Any kind of help will be appreciated. If you wanna the source code I can email you.


resolved. I have forgot return DefWindowProc in the message only window. tricky


  • A little complex compose of mouseover and mouseout
  • save the color of a text in a database and copy text with color into a richtextbox
  • Repaint window when no users are logged in
  • Python: win32gui.SetForegroundWindow
  • Focus Windows Explorer From C# App In Task Bar
  • When activating OLEControl in my PowerBuilder application, toolbar items disappear
  • How to make a messagebox disappear after 3 seconds?
  • UITableView cell goes blank when scrolling
  • Android Cursor RecyclerView does a flick on swipe
  • Fixed positioned elements disappear on page unload
  • Sending keystrokes from a C# application to a Java application - strange behaviour?
  • Adding Client Certifcate to Service Fabric
  • Implement Gauss-Jordan elimination in Haskell
  • Update SQL MS Access 2010
  • Grid creating extra spacing that I don't want
  • How to add a filter to Active Admin dashboard?
  • Swipe Gesture Recognizer not working for me
  • How to add System.Windows dll to Visual Studio 2010 express?
  • Create an Event Handler whenever a new Node is added in treeview
  • Fixed Background Works in Chrome but Not Firefox?
  • CRASH: *** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 9]
  • Add Windows Feature from C#
  • Reading space separated values file in c++ error
  • Need code translation from VB to C#
  • iText RadioGroup/RadioButtons across multiple PdfPCells
  • Set focus to first invalid form element in AngularJS
  • Git describe fails to return most recent annotated tag
  • SonarQube: Cannot deactivate rule with missing quality profile
  • How do I include a SWC in an AS2 Flash project?
  • How to add a focus style to an editable ComboBox in WPF
  • How do I superscript characters in a UIButton?
  • $wpdb not working in file of WordPress plugin
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • RectangularRangeIndicator format like triangular using dojo
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal