Old 22nd November 2004, 09:47   #1
AnotherXoltan
Junior Member
 
Join Date: Nov 2004
Posts: 2
n00b question -- checking Winamp activation method

Hey, I'm new to Winamp plugin creation. I've been bashing together, making my plugin and just ran into a serious logic error. I need to know how Winamp is activated to take the appropriate action. If Winamp is activated normally (just opening winamp.exe, no arguments), the plugin should be active. If, however, the user activates winamp with any arguments (ie. double clicking on an music file or playlist), the plugin should not do anything. I'm not sure if any of the WM_COMMAND or WM_USER variables I can toss at it will tell me this or not. I appriciate any ideas or suggestions and thanks in advance.

[ VC++6.0 on a Win2K box with Winamp v5.05 loaded ]
AnotherXoltan is offline   Reply With Quote
Old 22nd November 2004, 12:34   #2
Joonas
Forum King
 
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
I could need a real solution for this too...

But if no one has any better idea you can always look at the commandline. If you double-click a file it will activate Winamp with a commandline like "%path\winamp.exe /ADD %filename%". GetCommandLine() will return a LPSTR to this commandline.

But as I said...this is a bad way, would be better if Winamp could tell me..

As we are on the subject...it's also bad that playlists and mp3-files aren't loaded the same way...if I double-click a playlist when Enqueue as default action is activated it will start playing the first song (in the playlist editor, not necessarily the first song in the playlist-file)...if I double-click a mp3-file it will not.

Bad!

/Joonas
Joonas is offline   Reply With Quote
Old 22nd November 2004, 19:48   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
GetCommandLine() is pretty useless in this case since if you're running with multiple instances turned off you will only get the commandline for the initial loading of winamp (since winamp when loading the next time will send information to the first loaded instance) which makes this method tricky.

the only way for that to properly work would be to have a pass through loader.exe for winamp or to do a similar thing with one of the linked dlls (like the multi-user plugin does) and have that pass through the necessary calls, etc. either way it's all dirty

-daz
DrO is offline   Reply With Quote
Old 22nd November 2004, 19:55   #4
Joonas
Forum King
 
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
Oh, that's right. Silly me... :/

/Joonas
Joonas is offline   Reply With Quote
Old 23rd November 2004, 02:58   #5
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
Well Im pretty sure hes just talking about the first invocation anyway. When hes plugin is first called with init(), he can check GetCommandLine() to see how its started, and disable the plugin if there is any arguments. Sounds to me what he is trying to do, and should work ok.

If winamp is already started without arguments, then sure, doubleclicking a file will send it to Winamp without arguments. But thats the same as just dragging a file into the playlist after its already started as well, which is effectively all winamp.exe does to the running instance if its already running. hope that makes sense.

Basically he seems to only care about the first invocation and act on that. ie, if winamp starts without arguments he may want to continue playing where winamp left off or whatever.
shaneh is offline   Reply With Quote
Old 23rd November 2004, 23:15   #6
AnotherXoltan
Junior Member
 
Join Date: Nov 2004
Posts: 2
That's exactly what I was looking for, actually. Thank you guys. I was sitting out at my local coffee shop (MoJo's), trying to theorize ways around this, and my friend thought that maybe the HWND object stored the command line argument somewhere in it's bowels. This is effectively the same solution as he was suggesting (just strcmp the last 5 chars for ".exe\0" or something). Simple, elegant, not too brutish. Thanks guys, you rock! --E
AnotherXoltan 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