Finding the active forms focused control
I am creating a Keyboard control for my application. The keyboard will be in a panel1 on the main form. There is another panel on the Main Form (Panel2)that will display a differnt form (Form2). I need function that will find what control had the focus in the form that is diplayed in panel2. I think that as soon as you press a button on my keyboard control the control that had the focus will loose its focus.
Any guidance would be apprectiated. I found a really cool example of a keybord control online however it is in an application of its own and finds the windows activewindow and sends the key strokes to that app. So if I have notepad open and active, any key presses on the keyboard app will update notepad.
Dan
Re: Finding the active forms focused control
try this:
vb Code:
MsgBox(Form2.ActiveControl.ToString)
Re: Finding the active forms focused control
Didnt work.
Here is what I am trying to accomplish. I have found the following code as a starting point.
http://www.codeproject.com/KB/vb/screen.aspx
However this will send Windows Api key events to the active application. I would like to adapt this into a KeyBoard User Control for my application. There are 3 calls project that calls "SetActiveWindow(8975651603260375040)"
this will call the currently active window. I need to replace this and send the keycodes to the control that had focus prior to pressing the Keyboard control
Thanks
Dan