Discussion Overview
The discussion revolves around methods for running console programs in the background, particularly on Windows 2000, and how to handle keyboard events regardless of window focus. Participants explore various approaches, including using the Windows API, running applications as services, and utilizing libraries like ncurses.
Discussion Character
- Technical explanation
- Debate/contested
- Exploratory
Main Points Raised
- One participant asks how to run a console program in the background, similar to DNS or DHCP services.
- Another participant suggests that specifying the platform would be helpful, later confirming it is Windows 2000.
- Discussion includes the limitations of the Windows console compared to Unix/Linux, where background processes can be managed with commands like "bg" and "fg".
- One participant mentions the need for a program to detect keyboard events using the kbhit() function, noting that it only registers input when the window is focused.
- Another participant proposes using LowLevelKeyboardProc and the Windows API to achieve keyboard detection regardless of focus.
- There is a suggestion to run applications independently of the console window in Windows, similar to using '&' in Unix/Linux, and the idea of running programs as services is introduced.
- A participant shares a code snippet using the ncurses library to handle keyboard input, questioning if it would work without the terminal in focus.
- Another participant asserts that the terminal must be in focus to differentiate input between multiple programs, referencing a prior question about catching input regardless of focus.
- A workaround is suggested involving setting up a key-event with the desktop to bring the program to the foreground when a specific key is pressed.
- One participant references a resource on creating a service but expresses uncertainty about a simple method for capturing input not intended for the window.
Areas of Agreement / Disagreement
Participants express differing views on the feasibility of capturing keyboard input without window focus, with some asserting it is not possible while others suggest potential workarounds. The discussion remains unresolved regarding the best approach to run programs in the background on Windows.
Contextual Notes
Participants note the complexities involved in using the Windows API and creating services, as well as the limitations of the Windows console compared to Unix/Linux environments.