5101
Developer's Corner / Re: vs2008 express vc++ has anyone gotten RegisterHotKey to use mouse?
« Last post by Stoic Joker on September 11, 2010, 10:34 AM »Not sure exactly what you're after - Do you want/need to have a global system lever hot key registered? Or do you just want an application to look for/respond to A + B?
If it's application level you can use the below (snipped from an office project) in the message loop to get/capture/respond to keyboard or mouse events - combining them should be fairly straight forward.
Sorry I couldn't find a combo'ed example - I know I've done it somewhere - So it can't be too hard.
If it's application level you can use the below (snipped from an office project) in the message loop to get/capture/respond to keyboard or mouse events - combining them should be fairly straight forward.
Code: C++ [Select]
- //-------------------------------------+++--> END of Case WM_SYSCOMMAND
- //==================================================================================
- case WM_NOTIFY: {
- LPNMLISTVIEW pnm = (LPNMLISTVIEW)lParam;
- //------------------------------------------------------------------------------+++-->
- if(((LPNMHDR)lParam)->code == LVN_KEYDOWN) { //======== Capture Key Strokes Here. <<<
- hListView = GetWindow(hWnd, GW_CHILD); //-> ListView Child Control Handle
- LPNMLVKEYDOWN nmkey = (LPNMLVKEYDOWN)lParam;
- switch(nmkey->wVKey) {
- case VK_RETURN:
- if((int)SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED) != -1) {
- GetPartsOrderDetails(hListView, FALSE); // Open Selected Order(s)
- }else{ //----------------------------------//--+++-->
- GetPartsOrderDetails(hListView, TRUE); // Give User Error Message
- } break;
- }
- }
- //------------------------------------------------------------------------------+++-->
- if(((LPNMHDR)lParam)->code == NM_DBLCLK) { //========= Capture Mouse Clicks Here. <<<
- HWND hListView = GetWindow(hWnd, GW_CHILD); //-> ListView Child Control Handle
- if((int)SendMessage(hListView, LVM_GETNEXTITEM, -1, LVNI_SELECTED) != -1) {
- GetPartsOrderDetails(hListView, FALSE); // Open Selected Order(s)
- }else{ //----------------------------------//--+++-->
- GetPartsOrderDetails(hListView, TRUE); // Give User Error Message
- }
- }
- } //------------------------------------------------+++--> END of Case WM_NOTIFY
- //==================================================================================
Sorry I couldn't find a combo'ed example - I know I've done it somewhere - So it can't be too hard.

Recent Posts



