1. TSR capability under Windows
- Posted by GreenEuphorian Nov 27, 2014
- 1310 views
Can Euphoria create TSR programs? (Terminate and Stay Resident, in old DOS terminology - I don't know what it is called nowadays) I need a program that stays in the background and call be called by a key combination. How to achieve this under Windows?
Thanks
2. Re: TSR capability under Windows
- Posted by jimcbrown (admin) Nov 27, 2014
- 1326 views
Can Euphoria create TSR programs?
Not on it's own. Perhaps you could do it with some machine code additions, but the fact that eu runs in 32bit protected mode - even under DOS - might raise some additional complications. That said, there might already be something in the archives to get an Euphoria DOS32 TSR working....
(Terminate and Stay Resident, in old DOS terminology - I don't know what it is called nowadays)
The name is the same, but it only refers to the DOS technology. It's primary feature was the ability to work around the single tasking nature of DOS and (sorta) let two programs run at the same time.
I need a program that stays in the background and call be called by a key combination. How to achieve this under Windows?
IIRC to keep it in the background one simply hides all active windows and consoles. Then the program won't show up in the task bar....
When the key combo is pressed, you'd then make the windows visible again.
The only part that might not be available in a standard widget library would be detecting the key presses without any active windows visible.
Here's some generic information on how to hook to a specific key combination: http://stackoverflow.com/questions/19356830/how-can-i-create-a-global-hotkey-combination-that-includes-the-windows-key and http://stackoverflow.com/questions/18917716/windows-how-to-query-state-of-modifier-keys-within-low-level-keyboard-hook
Alternatively, you could use something like http://www.autohotkey.com/ to deal with the hotkey hooking for you, and have it run a command to notify your program when the combination has been pressed.
3. Re: TSR capability under Windows
- Posted by petelomax Nov 27, 2014
- 1310 views
Many years ago, I managed to wrap RegisterHotKey in Edita to catch VK_ESCAPE and close help files, and it works really well, and only closes the help file when it has focus, which is exactly what I wanted. However I cannot remember all the details and a quick glance at the source raised a few more questions than answers. Anyway, it clearly is possible. If you have a copy of Edita you might want to look in eaqj.ew, specifically setChmHotKey/closeChm/HotKeyEsc plus wherever those routines are being called from, then again maybe not.
HTH,
Pete
PS I ignored the TSR part, what I am trying to say is that it is possible to write a standard windows application that responds to keystrokes entered while another application has focus.
4. Re: TSR capability under Windows
- Posted by GreenEuphorian Nov 27, 2014
- 1283 views
Here's some generic information on how to hook to a specific key combination: http://stackoverflow.com/questions/19356830/how-can-i-create-a-global-hotkey-combination-that-includes-the-windows-key and http://stackoverflow.com/questions/18917716/windows-how-to-query-state-of-modifier-keys-within-low-level-keyboard-hook
Alternatively, you could use something like http://www.autohotkey.com/ to deal with the hotkey hooking for you, and have it run a command to notify your program when the combination has been pressed.
Thanks Jim. This is pretty much what I needed. I was forgetting that under Windows I won't have the burden of creating a TSR program myself, because multi-tasking is supported, as you pointed out. So, I will just go along with a normal Euphoria program, and bind it to some key combination through something like AutoKey.
5. Re: TSR capability under Windows
- Posted by GreenEuphorian Nov 27, 2014
- 1301 views
Here's some generic information on how to hook to a specific key combination: http://stackoverflow.com/questions/19356830/how-can-i-create-a-global-hotkey-combination-that-includes-the-windows-key and http://stackoverflow.com/questions/18917716/windows-how-to-query-state-of-modifier-keys-within-low-level-keyboard-hook
Alternatively, you could use something like http://www.autohotkey.com/ to deal with the hotkey hooking for you, and have it run a command to notify your program when the combination has been pressed.
Thanks Jim. This is pretty much what I needed. I was forgetting that under Windows I won't have the burden of creating a TSR program myself, because multi-tasking is supported, as you pointed out. So, I will just go ahead and create a normal Euphoria program, and bind it to some key combination through something like autokey.