I am using the API GetAsyncKeystate to capture a combination of keys which then loads and perform a form.show method. This form contains a text box which I want to have focus when the form is loaded.
This is what actually happens:
Say my VB app name is AAA. When I am in another active app, say BBB, I would press the key combo (alt-F12, for instance). This would call up a form (of AAA) to show on screen. The cursor blinks in a text box, which is the default object to get focus in this form. However, when I start typing, the text box does not take my input, because the active app is still BBB. If I now click on the form, I can enter text as usual.
I want to NOT have to FIRST click on the form to get focus, but instead, start typing right away into the text box after pressing the key combo. Preferably, this would all be done within AAA. Please help.
Here's a sample of some codes:
In form main:
If (GetAsyncKeyState(VK_F12)) Then
If (GetAsyncKeyState(VK_ALT)) Then ' Alt-F12 pressed
kbArray.kbByte(VK_F12) = 0
kbArray.kbByte(VK_ALT) = 0
In frmEntry, a text box gets the focus by default.
If you think this question deserves more points, please say so! I will increase if neccesary.