2020年8月5日 星期三

vb.net 將指定的視窗移到最前面 [Move select Window to Top]

1
2
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As IntPtr
    Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long





1
2
3
4
5
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim hwnd As Long = 68330
        SetForegroundWindow(hwnd) 'if you need to change the size of the window (not just its state)
        BringWindowToTop(hwnd) ' to activate a parent window via the child. if you send it a child window (perhaps a floating toolbar) the parent will be brought to front and have focus instead of the child.
    End Sub

沒有留言:

張貼留言