Results 1 to 3 of 3

Thread: Finding the active forms focused control

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    11

    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

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Finding the active forms focused control

    try this:

    vb Code:
    1. MsgBox(Form2.ActiveControl.ToString)

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    11

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width