That is what I am doing (except I am using "-onClick => $callback, -onRightClick => $callback2" in "$window->AddNotifyIcon(...);" instead of using Name_Event). The example I gave was just simplified to show the problem and nothing else. When I use TrackPopupMenu in either case, the menu callback doesn't execute until TrackPopupMenu is called a
time, as illustrated by the simplified example.