Old 22nd February 2009, 23:11   #1
fleoparra
Junior Member
 
Join Date: Feb 2009
Posts: 6
Add Item on Winamp View Menu

Hello,

i am developping a gen plugin, and i want to know, if it possible to add my own item on View Menu, like "PlayList Editor"?

I Create Option Menú with:


int len = strlen("Let&ras ACL\tAlt+R")+1;
wchar_t *wText = new wchar_t[len];

memset(wText,0,len);
::MultiByteToWideChar(CP_ACP, NULL,"Let&ras ACL\tAlt+R", -1, wText,len );

HMENU hMenu=(HMENU)SendMessage(g_Plugin.hwndParent,WM_WA_IPC,(WPARAM)3,IPC_GET_HMENU);
AppendMenu(hMenu,MF_STRING,ID_Load,wText);


But that code don't create on view menu:

** 0 : main popup menu
** 1 : main menubar file menu
** 2 : main menubar options menu
** 3 : main menubar windows menu
** 4 : main menubar help menu
** other values will return NULL.

It does not exists the option for View Menu

I want to create an option into View menú as attach image


Thanks a lot

Fabio Parra
Attached Images
File Type: jpg image.jpg (20.8 KB, 233 views)
fleoparra is offline   Reply With Quote
Old 23rd February 2009, 08:45   #2
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
Use additional WINDOWS MENU FUNCTIONS to get the view menu and add your item. Consult Windows SDK documentation.
griffins_Grader is offline   Reply With Quote
Old 23rd February 2009, 19:02   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
i think there was a change in that api a long time back which wasn't updated in the sdk (i think it's been wrong in the sdk's since the 5.0 release seeing as it was implemented for 2.9x which didn't have modern skin support which caused an expansion of the menus available). here's what i have in my own file (will hopefully appear in one of the next sdk builds).
code:
#define IPC_GET_HMENU 281
/* (requires Winamp 2.9+)
** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)menu_required,IPC_GET_HMENU);
**
** For 2.9x installs the following values are valid:
** 0 : main popup menu (mapped to -1 in 5.x installs)
** 1 : main menubar file menu
** 2 : main menubar options menu
** 3 : main menubar windows menu
** 4 : main menubar help menu
**
** For 5.x client versions the following values are valid (changed due to Modern skin support):
** -1 : the main winamp menu resource (same as doing LoadMenu(winamp_module_or_lng_file,101)
** 0 : main popup menu
** 1 : main menubar file menu
** 2 : main menubar play menu
** 3 : main menubar options menu
** 4 : main menubar windows menu
** 5 : main menubar windows help
** 6 : playlist editor menubar file menu
** 7 : playlist editor menubar playlist menu
** 8 : playlist editor menubar sort menu
** 9 : media library menubar file menu
** 10 : media library menubar view menu
**
** In all client versions, unsupported values will return NULL.
**
** e.g. (psuedo code to add an item to the end of the main window 'view' menu)
** HMENU windows_menu = (HMENU)SendMessage(hwnd_winamp,WM_WA_IPC,4,IPC_GET_HMENU);
** if(windows_menu)
** {
** // WA_MENUITEM_ID is obtained from IPC_REGISTER_WINAMP_IPCMESSAGE or a predefined
** // value if that api is not supported on the client version you are working with.
**
** int window_visible = 1; // this would be updated as needed for the window view state
** MENUITEMINFO i = {sizeof(i), MIIM_ID | MIIM_STATE | MIIM_TYPE, MFT_STRING,
** window_visible ? MFS_CHECKED : 0, WA_MENUITEM_ID};
** i.dwTypeData = "My Menu Item";
** InsertMenuItem(windows_menu, GetMenuItemCount(windows_menu), TRUE, &i);
**
** // now tell Winamp that we've added an item so it can adjust accordingly (if needed)
** // (use IPC_ADJUST_FFWINDOWSMENUPOS for adding to menu_required = 4)
** // (use IPC_ADJUST_OPTIONSMENUPOS for adding to menu_required = 0)
** SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_ADJUST_FFWINDOWSMENUPOS);
** }
*/

-daz
DrO is offline   Reply With Quote
Old 24th February 2009, 01:39   #4
fleoparra
Junior Member
 
Join Date: Feb 2009
Posts: 6
Thanks DrO for your help.

I have fixed my problem with your code.


Thanks,

Fabio
fleoparra is offline   Reply With Quote
Old 24th February 2009, 04:51   #5
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
Quote:
Originally posted by DrO
i think there was a change in that api...
True. I had to use windows helper functions to place an item.
griffins_Grader is offline   Reply With Quote
Old 24th February 2009, 12:16   #6
DrO
 
Join Date: Sep 2003
Posts: 27,873
@fleoparra: good to hear that

@griffins_Grader: i'm wondering what 'windows helper functions' you're refering to?

-daz
DrO is offline   Reply With Quote
Old 24th February 2009, 16:01   #7
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
The Menu Functions in windows sdk like GetMenuItemInfo etc,,,
griffins_Grader is offline   Reply With Quote
Old 26th February 2009, 12:32   #8
DrO
 
Join Date: Sep 2003
Posts: 27,873
hmm, k. can't really see how that would have helped in this situation, oh well.

-daz
DrO is offline   Reply With Quote
Old 26th February 2009, 16:05   #9
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
It wasn't a straight forward approach, I used it because I didn't know of the WPARAMs (5-10) that you posted. Pretty much the Windows SDK menu functions gives menu item's name and position. I used the position and name to get to where I wanted.
griffins_Grader is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump