View Full Version : Plug-in custom hotkey
Tokelil
05-12-2004, 11:59 PM
I was wondering if there is a way for a plug-in to add a hotkey (accelerator key) to QCD? The native accel. keys defined in QCD works regardless of what window has focus, which is nice. (QCDLib adds the Alt+B key, but it only works when the main window has focus)
I dont know if this is possible now, but else I could imagine an op taking an ACCEL struct do it, and op's to check if a key combination is free etc.
Or maybe there's already a way to do it and I missed it?
See opSetAccelerator in QCDModDefs.h
Tokelil
05-13-2004, 12:19 AM
Doh... I wonder how I missed that since I read about all the other op's in that section ealier today! :ponder:
Thanks!
Tokelil
05-17-2004, 11:55 PM
Any chance that you could add to opSetAccelerator if the accelerator is already in use by QCD or another plug-in?
See opSetAccelerator in QCDModDefs.h
For some reason I could never get this op to work properly. Everything I tried just brought up the QCDLib preferences menu? Perhaps you can explain how QCD uses this... for example, when you register Alt+B does QCD send that message along to the owner window or to the QCD main menu or something else?
It works the same as menus - the ID you pass in for param1 to opSetAccelerator alongside the AccelInfo will be passed to the plugin's Config function when the accelerator is typed.
It works the same as menus - the ID you pass in for param1 to opSetAccelerator alongside the AccelInfo will be passed to the plugin's Config function when the accelerator is typed.Well that would explain why I keep getting my configuration when I test the accel keys. But the flags parameter of the config function is always 1 - not my menuid... ???
not my menuid... ???
Are we talking about accellerators or menus? opSetAccelerator or opSetMenuItem?
Are we talking about accellerators or menus? opSetAccelerator or opSetMenuItem?
opSetAccelerator - I'm passing my menuid as the 1st param
For example, this sets Ctrl+L as an accelerator:
AccelInfo accel = { sizeof(AccelInfo), AI_VIRTKEY|AI_CONTROL, 'L' };
QCDCallbacks.Service(opSetAccelerator, g_hInstance, 2, (long)&accel);
When Ctrl+L is typed, the plugin's Config is called with flag=2
For example, this sets Ctrl+L as an accelerator:
AccelInfo accel = { sizeof(AccelInfo), AI_VIRTKEY|AI_CONTROL, 'L' };
QCDCallbacks.Service(opSetAccelerator, g_hInstance, 2, (long)&accel);
When Ctrl+L is typed, the plugin's Config is called with flag=2
I figured out the problem... it was very difficult to find considering how basic it was. When I translated the C++ to Delphi a few years back, I was using the stdcall calling convention for the Config proc. Stdcall is faster and works fine, unless you are using the flags... once I switched my calling convention to cdecl everything worked as expected. Sheesh... :)
p.s. How is that UVOX input plugin coming along? I've received about 10 e-mails today from SpinAmp users saying that AOL has flipped the switch on the old system... so that UVOX plugin is sorta needed. Send me an e-mail if you need more info on the protocol.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.