indigoblue
Programmer
Hi, im trying to use a popup menu near to the clock - i've got the following to work:
- a) icon displayed in system tray
- b) main callback function receiving mouse messages from the icon
- c) a menu defined in my resource file
however, when i execute the code below, I get what looks like a popup menu, at the correct position (on top of the icon) but it only has the width of a couple of pixels. I can click on the very thin bar & it seems to have the spacers in the correct position, but its quite useless because i cant see any text (im using vs.net btw if that helps...)
code:
case WM_TRAYICON:
traymenu = LoadMenu(NULL,MAKEINTRESOURCE(IDR_OPENMENU));
switch(lParam)
{
case WM_RBUTTONDOWN:
// Display and track the popup menu
#ifdef _WIN32_WCE
DWORD messagepos = GetMessagePos();
point.x = GET_X_LPARAM(messagepos);
point.y = GET_Y_LPARAM(messagepos);
#else
GetCursorPos(&point);
#endif
SetForegroundWindow(hWnd);
TrackPopupMenu(traymenu,TPM_RIGHTBUTTON,point.x,point.y,0,hWnd,NULL);
PostMessage(hWnd, WM_NULL, 0, 0);
DestroyMenu(traymenu);
anyone got any ideas why this is wrong?
- a) icon displayed in system tray
- b) main callback function receiving mouse messages from the icon
- c) a menu defined in my resource file
however, when i execute the code below, I get what looks like a popup menu, at the correct position (on top of the icon) but it only has the width of a couple of pixels. I can click on the very thin bar & it seems to have the spacers in the correct position, but its quite useless because i cant see any text (im using vs.net btw if that helps...)
code:
case WM_TRAYICON:
traymenu = LoadMenu(NULL,MAKEINTRESOURCE(IDR_OPENMENU));
switch(lParam)
{
case WM_RBUTTONDOWN:
// Display and track the popup menu
#ifdef _WIN32_WCE
DWORD messagepos = GetMessagePos();
point.x = GET_X_LPARAM(messagepos);
point.y = GET_Y_LPARAM(messagepos);
#else
GetCursorPos(&point);
#endif
SetForegroundWindow(hWnd);
TrackPopupMenu(traymenu,TPM_RIGHTBUTTON,point.x,point.y,0,hWnd,NULL);
PostMessage(hWnd, WM_NULL, 0, 0);
DestroyMenu(traymenu);
anyone got any ideas why this is wrong?