a3deluxe Posted February 20, 2016 at 12:44 AM Report Share #593711 Posted February 20, 2016 at 12:44 AM Boa noite, Como posso saber o nome da janela da seguinte imagem? Queria Trazer-la para a Frente de todos os outros programas. Como posso fazer isso em VB.net? Obrigado Link to comment Share on other sites More sharing options...
Solution vikcch Posted February 20, 2016 at 05:59 PM Solution Report Share #593713 Posted February 20, 2016 at 05:59 PM (edited) Se não sabes exactamente o titulo da janela podes usar como está no exemplo..... caso contrario podes ir buscar o handle da janela com a api FindWindow Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr Public Class Form1 Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As IntPtr) As Integer Private Declare Function SetFocus Lib "user32.dll" (ByVal hWnd As IntPtr) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For Each p As Process In Process.GetProcesses() 'Debug.WriteLine(p.ProcessName) If p.ProcessName.Contains("DOSBox") Then SetForegroundWindow(p.MainWindowHandle) SetFocus(p.MainWindowHandle) End If Next End Sub End Class Edited February 20, 2016 at 06:00 PM by vikcch Link to comment Share on other sites More sharing options...
a3deluxe Posted February 21, 2016 at 10:55 PM Author Report Share #593725 Posted February 21, 2016 at 10:55 PM Obrigado vikcch Grande ajuda, já esta resolvido, Obrigado 🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now