Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: New playlist context item / Message to other program (Read 2228 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

New playlist context item / Message to other program

Hi there,

before spending a lot of time to get myself into the foobar2000 SDK I wanted to ask if the following is possible at all:

I want write a component which adds a new entry into the context menu of my playlist (EL-Playlist in this case). After choosing this entry the component should look for the path of the selected item(s) and send it's path and a code to a specific program running in the background.

When thinking about the code I guess this is isn't very hard at all.
But is it possible?

Thanks for you help!

Greetz, Kane

New playlist context item / Message to other program

Reply #1
Sure, it is trivial.
Code: [Select]
#include "../SDK/foobar2000.h"

void DoMyCommand(metadb_handle_list_cref items)
{
  // TODO: Make this work even with more than one item, use some better inter-process communication, etc.
  uShellExecute(NULL, NULL, "MyProgram.exe", items[0]->get_location().get_path(), NULL, SW_SHOWNA);
}

const GUID guid_MyCommand = { !generate yourself! };
DECLARE_CONTEXT_MENU_ITEM(MenuItem_MyCommand, "My Command", "Utils", DoMyCommand, guid_MyCommand, "Sends path of selected track to My Program running in the background.");

DECLARE_COMPONENT_VERSION("My component", "1.0", "More information.");
Full-quoting makes you scroll past the same junk over and over.

 

New playlist context item / Message to other program

Reply #2
Just as I hoped, thank you!