void AllegroTextBox::Update() { if(mouse->button & 1) { SetFocus(false); if(mouse->x > m_xPos && mouse->x < m_xPos + GetWidth()) { if(mouse->y > m_yPos && mouse->y < m_yPos + GetHeight()) { SetFocus(true); } } } if(m_hasFocus) { char Letter = GetKeyPressed(curKeys); if(Letter == 1) { m_value.truncate(m_value.size() -1); } else if(Letter != 0) { m_value += Letter; } } }
int main(void) { /* Initializing the LCD module */ // InitLCD(LS_BLINK|LS_ULINE); /* Displaying the Home Screen */ // LCDWriteString("S-Nav has begun!"); DDRD=0X0F; while(1) { switch(GetKeyPressed()/4) { case 0: PORTD=0X01 break; case 1: PORTD=0X02 break; case 2: PORTD=0X04 break; case 3: PORTD=0X08 break; } } }
char Input::GetLetterPressed() { for (std::map<char, sf::Keyboard::Key>::iterator i=letters.begin();i!=letters.end();i++) { if (GetKeyPressed(i->second)) { if (GetKeyIsPressed(sf::Keyboard::LShift)) { return (i->first-32); }; return (i->first); }; }; return 0; };
__declspec(dllexport) void main() { Init(); __try { switch ( *(DWORD *)(0x00DDDC00) ) { /*case 0x508B018B : // 1.7.7.0 (2012) { break; } */ case 0x5FFFF2DD : // 1.8.151.0 (2012) { break; } default : { ShowVersion(); return; } } if(!EasySteam::Interface::GetInstance() || !EasySteam::Interface::GetInstance()->GetUser()->IsLoggedOn()) { Debug::ShowMessageBox("Unable to retrieve steam."); return; } Skyrim::RegisterOnlineScript(); srand((unsigned int)time(NULL)); PrintNote("To play Skyrim Online, press F3"); while(!Skyrim::TheGameWorld) { if(GetKeyPressed(VK_F3)) { NewInstance(); Skyrim::TheGameWorld->Setup(); break; } Wait(0); } if(Skyrim::TheGameWorld) Skyrim::TheGameWorld->Run(); } __except(GenerateDump(GetExceptionInformation())) { } }
int main(int argc, char** argv) { WORD KeyVal; char ResString[10]; void Ludacris_Speed_GO(void); Ludacris_Speed_GO(); InitGlobals(); InitLCD(); Timer1_Setup(); UART1_Config(); Pin_Setup(); printf("\nUART Configured\n\n"); while(1) { __delay_ms(250); PutsXLCD("No Workie! "); if(!Calculate) { if(TriggerGetKeys) { KeyVal = GetKeyPressed(); FindKey(KeyVal); if(Key != NULL) { ParseInput(Key); } TriggerGetKeys = 0; } } else { DoCalculate(); printf("%f\n", Terms.Result); sprintf(ResString, "%f", Terms.Result); PutsXLCD(ResString); TriggerGetKeys = 0; Calculate = 0; GotOperand1 = 0; GotOperand2 = 0; Operation = NO_OP; } } return (EXIT_SUCCESS); }
__declspec(dllexport) void main() { //std::ostringstream os; //for(int i = 0; i < 6; ++i) // os << Actor::Item //Log::GetInstance()->Debug(os.str()); CLR_Init(); srand((unsigned int)time(NULL)); PrintNote("To play Skyrim Online, press F3"); bool onlineMod = false; while(!SkyrimOnline::Mod::Exists()) { if(GetKeyPressed(VK_F3)) { onlineMod = true; break; } Wait(0); } if(onlineMod || SkyrimOnline::Mod::Exists()) SkyrimOnline::Mod::GetInstance().Run(); }
// returns TRUE if exiting int ProcessKeys(int numEvents) { DWORD numChars; TCHAR key; if ((ProcessCount-scrolled < 17) && (ProcessCount > 17)) scrolled = ProcessCount-17; key = GetKeyPressed(numEvents); if (key == KEY_QUIT) return TRUE; else if (key == KEY_KILL) { // user wants to kill some process, get his acknowledgement DWORD pId; COORD pos; TCHAR lpStr[100]; pos.X = 1; pos.Y =ScreenLines-1; if (LoadString(hInst, IDS_KILL_PROCESS, lpStr, 100)) WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); do { GetNumberOfConsoleInputEvents(hStdin, &pId); key = GetKeyPressed(pId); } while (key != KEY_YES && key != KEY_NO); if (key == KEY_YES) { HANDLE hProcess; pId = pPerfData[selection+scrolled].ProcessId; hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pId); if (hProcess) { if (!TerminateProcess(hProcess, 0)) { if (LoadString(hInst, IDS_KILL_PROCESS_ERR1, lpStr, 80)) { WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars); WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); } Sleep(1000); } CloseHandle(hProcess); } else { if (LoadString(hInst, IDS_KILL_PROCESS_ERR2, lpStr, 80)) { WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars); _stprintf(lpStr, lpStr, pId); WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); } Sleep(1000); } } first = 0; } else if (key == VK_UP) { if (selection > 0) selection--; else if ((selection == 0) && (scrolled > 0)) scrolled--; } else if (key == VK_DOWN) { if ((selection < ProcPerScreen-1) && (selection < ProcessCount-1)) selection++; else if ((selection == ProcPerScreen-1) && (selection+scrolled < ProcessCount-1)) scrolled++; } else if (key == VK_PRIOR) { if (scrolled>ProcPerScreen-1) scrolled-=ProcPerScreen-1; else { scrolled=0; //First selection=0; } //selection=0; } else if (key == VK_NEXT) { scrolled+=ProcPerScreen-1; if (scrolled>ProcessCount-ProcPerScreen) { scrolled=ProcessCount-ProcPerScreen; //End selection=ProcPerScreen-1; } //selection=ProcPerScreen-1; if (ProcessCount<=ProcPerScreen) //If there are less process than fits on the screen { scrolled=0; selection=(ProcessCount%ProcPerScreen)-1; } } else if (key == VK_HOME) { selection=0; scrolled=0; } else if (key == VK_END) { selection=ProcPerScreen-1; scrolled=ProcessCount-ProcPerScreen; if (ProcessCount<=ProcPerScreen) //If there are less process than fits on the screen { scrolled=0; selection=(ProcessCount%ProcPerScreen)-1; } } return FALSE; }
//Callback function for the dialog where the user can change hotkeys. BOOL CALLBACK ChangeInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static HANDLE hThread = NULL; static DWORD dwThreadId = 0; static struct INPUTDLGTHREADARGS threadargs; static int key = 0; switch (uMsg) { case WM_INITDIALOG: { // Start the message thread. threadargs.hThreadExit = CreateEvent(NULL, TRUE, FALSE, NULL); threadargs.hwndDlg = hwndDlg; hThread = CreateThread(NULL, 0, NewInputDialogThread, (LPVOID)&threadargs, 0, &dwThreadId); key = 0; memset(keyonce, 0, sizeof(keyonce)); KeyboardSetBackgroundAccess(true); SetFocus(GetDlgItem(hwndDlg, LBL_KEY_COMBO)); CenterWindowOnScreen(hwndDlg); } return FALSE; case WM_COMMAND: switch(LOWORD(wParam)) // CaH4e3: BN_CLICKED redundant define removed since it always 0, Esc mapping used to be handled as well (I need it too :)) { case BTN_OK: // Send quit message. PostMessage(hwndDlg, WM_USER + 99, 0, 0); break; case BTN_CLEAR: key = -1; // Send quit message. PostMessage(hwndDlg, WM_USER + 99, 0, 0); break; default: break; } break; case WM_USER: { // Our thread sent us a timer signal. int newkey; int meta = GetKeyMeta(key); KeyboardUpdateState(); if((newkey = GetKeyPressed()) != 0) { key = newkey | meta; ClearExtraMeta(&key); SetDlgItemText(hwndDlg, LBL_KEY_COMBO, GetKeyComboName(key)); } else if(NothingPressed() && key) { PostMessage(hwndDlg, WM_USER + 99, 0, 0); // Send quit message. } } break; case WM_CLOSE: // exit without changing the key mapping key = 0; case WM_USER + 99: // Done with keyboard. KeyboardSetBackgroundAccess(false); // Kill the thread. SetEvent(threadargs.hThreadExit); WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); CloseHandle(threadargs.hThreadExit); // End the dialog. EndDialog(hwndDlg, key); return TRUE; default: break; } return FALSE; }
int main(int argc, char **argv) { int lid = LID_UNKNOWN; int power = PWR_UNKNOWN; int brightscr=1023; //screen brightness on AC (default at start) int brightkeyb=512; //keyboard brightness on AC int dimscr=512; //screen brightness on battery int dimkeyb=300; //keyboard brightness on battery int keyTimer = 0; system("echo -ne \"\\033[9;0]\" >/dev/tty0"); //set screen blank to never -- it doesn't blank the frame buffer so don't use it //intialize the keyboard lights keyb(powerstate() == PWR_AC_CORD?brightkeyb:dimkeyb); keys_timerid = create_timer(KEYS_TIMER, KEYS_TIMEOUT); lcd_timerid = create_timer(LCD_TIMER, LCD_TIMEOUT); power_timerid = create_timer(POWER_TIMER, 0); signal(SIGQUIT, _powerDown); signal(SIGINT, _suspend); signal(SIGUSR1, _newMsg); while(1) { //main loop if( (!power || newMsg) && GetKeyPressed() == 1) //if there is power the timers are not active, so nothing needs to be done { if(!power){ //a key has been pressed -- reset the timers set_timer(keys_timerid, KEYS_TIMEOUT); set_timer(lcd_timerid, LCD_TIMEOUT); screenOn(); } if(newMsg && valkeyb){ //stop flashing the keyboard keyb(valkeyb); toggleLED(0); valkeyb = 0; newMsg = 0; } } if(newMsg){ if(!valkeyb) valkeyb = getkeyb(); toggleLED(flashKeyBrd); if(flashKeyBrd){ keyb(valkeyb); flashKeyBrd=0; } else{ keyb(0); flashKeyBrd=1; } } if(powerDown && !suspend) { set_timer(power_timerid, POWER_TIMEOUT); powerDown = 0; } if(suspend) { set_timer(power_timerid, 0); suspend = 0; powerDown = 0; } if(lid != lidstate()) { lid = lidstate(); lightswitch(lid); } if(power != powerstate()) { //there has been a change in the powerstate keyTimer = 0; power = powerstate(); if (power) { //AC is plugged in // system("echo -ne \"\\033[9;0]\" >/dev/tty0"); //set screen blank to never screenOn(); set_timer(keys_timerid, 0); set_timer(lcd_timerid, 0); dimscr = getscr(); //store current brightness as dim values dimkeyb = getkeyb(); keysOn(); lcdb(brightscr); keyb(brightkeyb); //and brighten lights } else{ //AC is unplugged // system("echo -ne \"\\033[9;1]\" >/dev/tty0"); //set screen blank to 1 minutes set_timer(keys_timerid, KEYS_TIMEOUT); set_timer(lcd_timerid, LCD_TIMEOUT); brightscr = getscr(); //store current brightness as bright brightkeyb = getkeyb(); lcdb(dimscr); keyb(dimkeyb); //and dim lights } } sleep(1); //wait one second } }