Sign in to follow this  
Followers 0
supraspecies

Emulation and Hotkeys

3 posts in this topic

#1 ·  Posted (edited)

I've been testing hotkeys in DOSBox and stumbled upon a curious thing. Hotkey set/unset works perfect for Windows applications, but under DosBox, settings them works fine, but unsetting doesn't work at all. Here's an example:

$pid=Run(@ScriptDir & '\DOSBox\DOSBox.exe')
ProcessWait($pid)

While ProcessExists($pid)
If WinActive("[REGEXPTITLE:DOSBox;CLASS:SDL_app]") Then
   HotKeySet("{F1}", "start")
   HotKeySet("{F2}", "stop")
   HotKeySet("{F9}", "close")
Else
   HotKeySet("{F1}")
   HotKeySet("{F2}")
   HotKeySet("{F9}")
EndIf
WEnd

I have added an MsgBox right after "Else",and it does pop up when DOSBox window is minimized - so the minimization factor is detected. But how come unsetting keys does nothing, and when DOSBox is minimized and I'm in Windows, the hotkeys still don't work (apparently, still tied to DOSBox on a system-wide scale).

As I said, this code works for Windows applications just fine. So what do you think is getting in the way in this case? And how can I solve it (i.e. unregister hotkeys)?

BTW, is there any possibility to assign the hotkeys to work within an application and not be locked system-wide aside from the method I'm using?

Edited by supraspecies

Share this post


Link to post
Share on other sites



the most executables for dos have there own keyboardhandler.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

12 minutes ago, AutoBert said:

the most executables for dos have there own keyboardhandler.

Thanks for the information, I get it now. Though I'm still somewhat puzzled why setting keys works within DOSBox then. The assigned hotkeys work. I'd assume it wouldn't work both ways.

EDIT: I think I realize why. Because setting keys works for DOSBox itself - which is what I'm doing. But does not work for the application that is running within DOSBox. So while DOSBox is simply started and not in emulation state, you can set the keys. But once it starts emulating the application, that application uses its own handler. The keys set before emulation starts still work though, as they are considered a part of original DOS key handler.

Or something along these lines. :) Would that be a somewhat accurate guess? And can anyone think of an unlikely way around this? Pretty sure there isn't one though, unless I somehow work with the original application key handler or stop/suspend the emulation for a time.

Edited by supraspecies

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0