How to simulate keyboard press on turbo debugger for DOSBOX? - debugging

A program I'm writing needs to check keyboard press and loop until it has in the buffer, then check what key was pressed, so when I run it in the debugger, it loops forever because there is no keyboard press.
Until now I've just changed the lines on the program to skip checking keyboard and jump right to the place I want to check, but is there any less exhausting way to do it?

Related

How does TranslateAccelerator know about CTRL or SHIFT modifier?

I'm working in a program that uses Accelerator keys for user-defined hot keys, and every thing works fine. The user can set hotkeys using SHIFT, CTRL, or ALT. I know that using ALT generates a WM_SYSKEYDOWN rather than WM_KEYDOWN, so it's pretty obvious when ALT is held down.
TranslateAccelerator only takes a window handle, the accel table handle and a single KEYDOWN message. So, my question is, if the user presses CTRL+T, how does TranslateAccelerator know the CTRL key was also pressed?
I know that the CTRL generates a separate KEYDOWN command, and I specifically filtered those out (do not pass to TranslateAccelerator) to test a theory, but TranslateAccelerator is still working.

vb6: interrupt endless msgbox loop

I am writing a program in VB6.
By mistake many times my code contains an endless loop, inside which there is a message box. For example:
while a>0
msgbox "a is positive"
wend
Then I press the play/run and I realize what has happened. Is there any way to stop the debugging/running of my program?
The only thing that works so far is Ctrl+Alt+Del and end task. But this way the whole visual basic closes and I lose my unsaved data. (please don't comment that I should save my program more often. I know it (now)).
Edit: I found on the internet that maybe esc or ctrl+c or ctrl+break could do the job. The first two do nothing and my laptop doesn't have a break key
Solution: I have the insert key in my laptop. on the key there is also written pause for use along with the Fn key. So I was able to break the application by pressing Ctrl+Fn+Insert (which maybe could be translated in Ctrl+Pause)
edit: link to photo of my keyboard:
ctrl + break will work. If you don't have those keys, use the on screen keyboard.
Start | Run | osk
Then press ctrl + break.

Windows Driver: Input and Output

I'm reading about windows drivers and in the resources I read, input is generally done by a user program calling WriteFile on the devices file and output is done by a user program calling ReadFile (or by DbgPrint).
Is it possible for a device to get input directly from keyboard and outputing directly to the screen without interfering with display/keyboard drivers?
More specifically, let's say I'd like to write a driver working as following. Whenever the F10 key is pressed everything freezes and the screen becomes red; pressing F10 again restores everything. How would I do it?
Very short answer,
Whenever the F10 key is pressed everything freezes
You may want to write keyboard class filter to read keys pressed. Here is sample
the screen becomes red
You may want to write display/monitor filter driver. Reference

Simulate key presses in C++

I want my program to press certain keys on my keyboard without me doing it physically.
So I need a subroutine that simulates pressing any key.
What code could I use to accomplish this (Press Any Key) in C++?
(I'm creating a program for MacOSX in Xcode)
Ok I got the mouse sorted now I just need key presses
You could use low-level event functions such as CGEventPost. At a higher level, look at the Accessibility APIs, such as AXUIElementPerformAction.

How do you stop Visual Studio from waiting for the second part of a shortcut-combination?

If I press a shortcut combination (such as Ctrl+M) – VS waits for the second one. What if I want to cancel it? (e.g. if I mistakenly press the wrong letter and am not sure which one.)
It just waits, with the "(Ctrl+M) was pressed. Waiting for a second key of chord..." in the bottom of the screen.
How do I cancel it?
Press Escape. Usually it is not tied as a second keystroke.
I normally press Esc .
I don't know of any keyboard shortcut where Esc is the second key press.
There aren't many visual studio Chords that end with Esc so just hit Esc it'll say The key combination is not a command but it prevents you from performing a valid chord.
Another option is to record a no-op macro and assign it to Ctrl-M, Esc. It will say running macro at the bottom quickly and go away.
You are in Dvorak Keyboard mode in windows. Press Ctrl+Shift to get out of it...

Resources