0

I've got an application that I'm trying to use as a keyboard to type special characters. It currently has this function (not my code!):

Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim baseParams As CreateParams = MyBase.CreateParams

        Const WS_EX_NOACTIVATE As Integer = &H8000000
        Const WS_EX_TOOLWINDOW As Integer = &H80
        baseParams.ExStyle = baseParams.ExStyle Or CInt(WS_EX_NOACTIVATE Or WS_EX_TOOLWINDOW)

        Return baseParams
    End Get
End Property

This makes it so the form never receives focus, as I don't want to press a button on the form and then steal the focus. However, it also means that when I click outside the form, the window disappear, as it's positioned behind the focused application. The only way to use this program is to resize the application I want to type in, and position the window next to it. In other words, I can only use it like this:

enter image description here

So what I want to know is, how do I make it so I can position this application over the application I want to use it in, but when I press a button on the application, it still doesn't focus on that window?

Lou
  • 2,200
  • 2
  • 33
  • 66
  • What have you tried, right now I see nothing and that is not how SO works. Please update and inform us of what you tried and what doesn't work first before we help you. – Trevor Dec 19 '16 at 01:08
  • It sounds like you need a toolbar and not a separate form. Wouldn't that work for you? – GDS Dec 19 '16 at 01:08
  • @Zaggler I don't know how to bring the Form to the front when it's also not allowed to be focused. How can I tell you what I've tried if I don't know how to try anything? – Lou Dec 19 '16 at 01:09
  • @GDS I don't know, can you create those with Visual Studio? How does a toolbar practically differ from a form? – Lou Dec 19 '16 at 01:11
  • A toolbar is a component that you add to a form. It is in the toolbox section in visual studio when you are in the designer view of your form. – GDS Dec 19 '16 at 01:14
  • @GDS But that's still part of a Form I've got to control, surely. – Lou Dec 19 '16 at 01:22
  • In general you can't bring something to front when it can't be focused... – Trevor Dec 19 '16 at 01:26

1 Answers1

0

You can add Me.Topmost = True on your code or you can set the Forms Property to TopMost = True

Shadow Fiend
  • 351
  • 6
  • 18