Old 17th December 2003, 04:32   #1
Niver
Junior Member
 
Niver's Avatar
 
Join Date: Sep 2002
Location: Québec, Canada
Posts: 27
Send a message via AIM to Niver Send a message via MSN to Niver Send a message via Yahoo to Niver
API...

kichik, you said that there's an API for the hotkeys plug-in... Is it public? Is it available somewhere?

Thanks!
Niver is offline   Reply With Quote
Old 17th December 2003, 11:39   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Well, it'll probably be released along with the SDK anyway, but here it is.

*moved to wa dev forum*
Attached Files
File Type: zip wa_hotkeys.zip (853 Bytes, 552 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th December 2003, 14:08   #3
Niver
Junior Member
 
Niver's Avatar
 
Join Date: Sep 2002
Location: Québec, Canada
Posts: 27
Send a message via AIM to Niver Send a message via MSN to Niver Send a message via Yahoo to Niver
Thanks... But can you tell me what is the value of
IPC_REGISTER_WINAMP_IPCMESSAGE

The winamp5 sdk doesn't seems to be released yet, so I don't have this value...!
Niver is offline   Reply With Quote
Old 18th December 2003, 00:06   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th December 2003, 04:09   #5
Niver
Junior Member
 
Niver's Avatar
 
Join Date: Sep 2002
Location: Québec, Canada
Posts: 27
Send a message via AIM to Niver Send a message via MSN to Niver Send a message via Yahoo to Niver
Thanks, It works!
But I still have a problem. I call the IPC_GEN_HOTKEYS_ADD after the winamp window is shown, since I'm not sure I can know at which moment the hotkey plugin is loaded: If I call the IPC_GEN_HOTKEYS_ADD at the init() of my plugin it doesn't work (my plugin is probably loaded after the hotkey plugin).

So the user opens the preferences window, adds a hotkey for the actions I added to the hotkeys plugin. When Winamp is closed then reopened, the settings for these added actions are not restored, probably because when your plugin is initialized it doesn't know anything yet about the new actions...

What can I do? What is the precise moment (some WM_* message or some IPC_* message I could intercept) where I would have to register my hotkeys that would be _after_ the hotkeys plugin init, but _before_ the hotkeys settings loading?

Winamp Advanced Controls, the ultimate tray plugin!
Niver is offline   Reply With Quote
Old 18th December 2003, 04:59   #6
justin
Moderator Alumni
 
Join Date: Apr 2000
Location: USA
Posts: 315
Quote:
Originally posted by Niver
Thanks, It works!
But I still have a problem. I call the IPC_GEN_HOTKEYS_ADD after the winamp window is shown, since I'm not sure I can know at which moment the hotkey plugin is loaded: If I call the IPC_GEN_HOTKEYS_ADD at the init() of my plugin it doesn't work (my plugin is probably loaded after the hotkey plugin).

So the user opens the preferences window, adds a hotkey for the actions I added to the hotkeys plugin. When Winamp is closed then reopened, the settings for these added actions are not restored, probably because when your plugin is initialized it doesn't know anything yet about the new actions...

What can I do? What is the precise moment (some WM_* message or some IPC_* message I could intercept) where I would have to register my hotkeys that would be _after_ the hotkeys plugin init, but _before_ the hotkeys settings loading?
You should defer sending that message by PostMessaging() a window with a message, and when that message gets received, that means the message pump is running and it's safe.

-Justin
justin is offline   Reply With Quote
Old 18th December 2003, 05:23   #7
Niver
Junior Member
 
Niver's Avatar
 
Join Date: Sep 2002
Location: Québec, Canada
Posts: 27
Send a message via AIM to Niver Send a message via MSN to Niver Send a message via Yahoo to Niver
mmh... I don't think this will help me a lot.

I don't have any problem knowing when it's safe to send an IPC message. It's just that the Golbal hotkeys plugin, at the moment it loads its settings, doesn't know anything about the "custom" hotkey actions I added, so it can't load their settings... kichik (or anyone else), you probably used gen_hotkeys API with another plugin? How can it be acheived?

Here's the actual squence of events as I understand it:

1 Winamp starts
2 my plugin->init() is called
3 my plugin loads its settings
4 ...
5 gen_hotkeys->init() is called
6 gen_hotkeys loads its settings (but doesn't know yet about the custom actions)
7 ...
8 Winamp is idle
9 my plugin registers the new keys with the gen_hotkeys API
----

I think the step 9 should be between 5 and 6, but I don't know how to acheive that.

Winamp Advanced Controls, the ultimate tray plugin!
Niver is offline   Reply With Quote
Old 18th December 2003, 11:51   #8
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Do as Justin said.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th December 2003, 11:56   #9
Bizzeh
Forum Pirate
Beta Team
 
Bizzeh's Avatar
 
Join Date: Oct 2001
Posts: 2,032
Niver, you do know justin invented winamp... i think i may know what he is talking about.
Bizzeh is offline   Reply With Quote
Old 18th December 2003, 12:19   #10
Niver
Junior Member
 
Niver's Avatar
 
Join Date: Sep 2002
Location: Québec, Canada
Posts: 27
Send a message via AIM to Niver Send a message via MSN to Niver Send a message via Yahoo to Niver
Ok, ok, it works... obviously Justin was right (as usual) and I look stupid (as usual too ?...)

Thanks all for your help.

Winamp Advanced Controls, the ultimate tray plugin!
Niver is offline   Reply With Quote
Old 16th January 2004, 17:06   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Don't forget to zero the extended array in the insertion structure defined in wa_hotkeys.h before you send the add message. If you don't, your hot key action might not work as expected or at all in following versions of Winamp.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik 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