Keep form open when clicking on another application

857 views Asked by At

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?

1

There are 1 answers

0
Shadow Fiend On BEST ANSWER

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