I've never used Win32::, but having metaCPANned this, I am surprised you are not passing $menu as an event or 'on' parameter to the AddNotifyIcon function instead of the main window, although my surprise could mean nothing of course, under the circumstances.