Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Dark Star

Is it possible to Create System Tray menu from a resource menu in VC++

This topic is 5141 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I created a simple menu with VC++ as a resource and created an icon which happyly appears in the system tray in windows XP. I have attached the menu to the system tray icon like so:

// Get menu from resources

HMENU popMenu = LoadMenu(hInstance,(LPCSTR)IDR_MENU1);
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = global_hwd;
nid.hIcon= LoadIcon(hInstance, (LPCTSTR)IDI_SMALL);
nid.uCallbackMessage= WM_APP;
strcpy(nid.szTip,"Hidden Window");
nid.uID = 1;

and then later on I wanted to show the menu when the icon in the system tray is clicked like so:
if (lParam==WM_LBUTTONDOWN )
  POINT pt; 
  TrackPopupMenuEx(popMenu,TPM_HORIZONTAL | TPM_VERTICAL |   TPM_LEFTALIGN | TPM_RETURNCMD,pt.x,pt.y,global_hwd,NULL);

this works fine....it shows the icon in system tray and when clicked with left mouse button the menu comes up but without the menu text. Infact the menu appears "thin"..like only a few pixels wide. The height is the right but not the width. If anymenu option has a pop up menu, then that menu shows properly.. what am I doing wrong? DarkStar UK [ confused ] ------------------------------- Loves cross-posting because it works [edited by - Dark Star on May 27, 2004 5:00:32 PM]

Share this post

Link to post
Share on other sites
Have you tried using GetSubMenu() on popMenu and passing that to TrackPopupMenuEx()?

Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!