i got a few questions here

first off, when i create a popup menu (TrackPopupMenu) from system tray icon it works fine, but it only shows once. you click on it the first time and it shows and dissapears correctly, but if you click on it again after that it doesn't show

i'm using:

invoke SetForegroundWindow, hWnd
invoke TrackPopupMenu, hMenu, TPM_RIGHTALIGN, mpos.x, mpos.y, 0, hWnd, 0
invoke PostMessage, hWnd, WM_NULL, 0, 0

the window that it's subclassed too, is not a visible one, and it uses SetWindowLong to hook it to the proc address, could that be the problem ?

next question is about wParam commands, why in so many examples does it check ax (16bit?) instead of eax do i have to use ax, or will it work etiher way

also how do i change the icon in the system tray to the same icon as the program
is it something like this:

invoke GetModuleHandle
invoke LoadIcon, eax, IDI_WINLOGO
mov NID.hIcon, eax

Posted on 2004-03-03 21:18:54 by someone
You are probably using a resource based menu and using DestroyMenu each time you finish tracking the menu. You should only destroy the menu when you do not plan on using it again. Either that or you must reload or recreate the menu each time you call the TrackPopupMenuEx function. The window that you specify in TrackPopupMenu is only used as a destination for messages and does not affect the lifespan of any popup menus.

There are many API functions and especially messages that are designed to be compatible with the 16 bit version of Windows. You will find many functions that only use the lower word of a 32 bit parameter. These legacy functions seem pointless now but when Win32 was designed it had to allow for the code based to be easily ported to it.

Send a WM_GETICON message to the main window to get the handle to the apps icon.
Posted on 2004-03-03 22:37:52 by donkey
nope, it's an api based menu, not from resources, and the only time i call DestroyMenu is under WM_DESTROY when it exits.
i know the menu still exists, cause it will popup if you put a messagebox after PostMessage...WM_NULL
Posted on 2004-03-03 23:21:37 by someone
i can post the code if it'd help ?
Posted on 2004-03-04 08:14:02 by someone
Yeah, some code will help but it takes me the better part of 5 to 10 minutes to get to this post. I am not sure if I will answer here. I only check the board when I have something to do while waiting, like getting a coffee or taking a vacation. You can email the code to me if you like, my email address is accessible from my website.
Posted on 2004-03-04 14:13:10 by donkey