#include "stdafx.h" #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) { if (RegisterHotKey( NULL, 1, MOD_ALT | MOD_NOREPEAT, 0x42)) //0x42 is 'b' { _tprintf(_T("Hotkey 'ALT+b' registered, using MOD_NOREPEAT flag\n")); } MSG msg = {0}; while (GetMessage(&msg, NULL, 0, 0) != 0) { if (msg.message == WM_HOTKEY) { _tprintf(_T("WM_HOTKEY received\n")); } } return 0; }
JS
$('textarea').keyup(function(e) { if((e.ctrlKey && (e.which == 13 || e.which == 10)) || (e.altKey && e.which == 83)) { //Ctrl+Enter执行 return false; } if(e.which == 13){ //输入回车键 var h = $(this)[0].scrollHeight; if(h <= 100) { return true; } else { $(this).height($(this)[0].scrollHeight); return true; } }