2 Replies - 3706 Views - Last Post: 22 October 2010 - 11:54 AM Rate Topic: -----

#1 nelsonhoover  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-July 10

Prevent Form Focus

Posted 20 October 2010 - 08:41 AM

Hi,
I am writing an on screen keyboard in VB.NET for a touchscreen. My problem is; how do I keep my keyboard form from getting focus when someone clicks the buttons on it?
I have it on top using
Me.TopMost

That part is working great but I want to leave the current app have focus, not my keyboard.

I'm guessing I need to use Windows API functions to accomplish this, however, I have not found any good examples in VB.NET.

Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Prevent Form Focus

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1043
  • View blog
  • Posts: 4,057
  • Joined: 02-July 08

Re: Prevent Form Focus

Posted 20 October 2010 - 09:05 AM

Short of having a property on the keyboard that is of type Form where you set it to the current form and with each button click on the keyboard you reset the focus to this property and the current form will regain focus. Otherwise that is normal behavior.
Was This Post Helpful? 0
  • +
  • -

#3 nelsonhoover  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-July 10

Re: Prevent Form Focus

Posted 22 October 2010 - 11:54 AM

OK, now I'm getting the foreground window handle with the "GetForegroundWindow" API function, then using "SetForegroundWindow" to return focus after every key press. This works OK but the window (Notepad, for example) with focus still flickers (i.e. loses focus then quickly regains it) after every key press. Is there any way to make it work like Microsoft's on screen keyboard?

This post has been edited by nelsonhoover: 22 October 2010 - 11:55 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1