The Corsair User Forums  

Go Back   The Corsair User Forums > Corsair Product Discussion > Legacy Corsair Software > CUE 1.x and 2.x SDK

Thread Tools Search this Thread Rate Thread Display Modes
Old 11-11-2015, 05:03 AM
ranma1988 ranma1988 is offline
Registered User
Join Date: Nov 2015
Posts: 1
POST ID # = 819394
ranma1988 Reputation: 10
Default How to get states ok keyboard key

Hi im trying to triger events when a key was pressed.
do anyone have a solution for this?

My current solution works onnly for a-z keys.

for (int i = 0; i < 255 i++)
ledId = CorsairGetLedIdForKeyName((char)i);
//do action on ledId

the problem with this solution is that: CorsairGetLedIdForKeyName does not return values for ESC and any other key than a-z keys.

ESC(27) CorsairGetLedIdForKeyName -> CorsairLedId.CLI_Invalid
Old 03-16-2016, 02:41 PM
Yannicked's Avatar
Yannicked Yannicked is offline
Registered User
Yannicked's PC Specs
Join Date: Dec 2015
Location: Holland
Posts: 20
POST ID # = 842717
Yannicked Reputation: 10

Try creating a windows "hook" with the function and create a map from the virtual keycodes to the corsair id's (in the CorsairLedIdEnum.h file from the SDK)
HHOOK WINAPI SetWindowsHookEx(
  _In_ int       idHook, // probably WH_KEYBOARD_LL for the keyboard
  _In_ HOOKPROC  lpfn, // the callback 
  _In_ HINSTANCE hMod,
  _In_ DWORD     dwThreadId
Old 01-01-2018, 11:10 PM
hastegag hastegag is offline
Registered User
hastegag's PC Specs
Join Date: Dec 2016
Location: Northeast US
Posts: 913
POST ID # = 933287
hastegag Reputation: 20

not to revive an old post, but I was trying to get the register_callback.cpp example file from the latest SDK to recognize media keys. I was unable to simply add the VK_MEDIA_NEXT and STOP etc to the struct at the top of the example and in the includes and have them register within the callback example, but I'm assuming that was because the scope of that project was focused on the proprietary keys and the DLL call has something to do with it?

I realized the while loop at the bottom was a super bootleg way (once you comment out the getchar functions of the std io), of getting these to react with that same above mentioned function in windows.h of getasynchkeystate or similar.

This was my approach, but don't know if it is helpful to anyone:

Very bottom being the relevant stuff. Yannicked, thank you for posting the low level keyboard hook, I will be trying that in place of what I'm doing now but I need to get a better handle on it.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

All times are GMT -4. The time now is 12:55 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.