Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

[Resolvido] Pegar nome de janela ativa VB.NET

Collapse
This topic is closed.
X
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    [Resolvido] Pegar nome de janela ativa VB.NET

    Boas, eu até pensei em usar timer:
    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
    TextBox1.Text = TextBox1.Text + vbNewLine & GetActiveWindowTitle() + vbNewLine
    End Sub

    mas fica enchendo com a mesma janela aberta, então, alguém sabe de alguma forma de pegar a janela aberta uma vez só? e quando trocar pegar o titulo dessa nova janela aberta?

    Obrigado
    Last edited by John; 13-02-2012, 18:39.

  • Font Size
    #2
    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
    If TextBox1.Text = GetActiveWindowTitle() Then

    Else
    TextBox1.Text = TextBox1.Text + vbNewLine & GetActiveWindowTitle() + vbNewLine

    End Sub


    coloque algo antes do else se desejar
    " Att King Valentine "

    king_valentine@hotmail.com

    Comment


    • Font Size
      #3
      Postado Originalmente por Valentine Ver Post
      Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
      If TextBox1.Text = GetActiveWindowTitle() Then

      Else
      TextBox1.Text = TextBox1.Text + vbNewLine & GetActiveWindowTitle() + vbNewLine

      End Sub


      coloque algo antes do else se desejar

      Velho, mesmo assim fica repetindo a janela aberta, deixei o timer pra 0,3 segundos, e a cada 0,3 segundos fica repetindo o nome da janela aberta entende? eu gostaria que o timer verificasse a janela ativa e escrevesse caso trocasse, por exemplo:
      o usuario ta no firefox e entra no google, o programa registre no textbox: Google - Mozilla Firefox, depois ele vai no msn, dai que o programa registre no textbox: Windows Live messenger, mas ta acontecendo o seguinte, a cada 0,3 segundos ele fica registrando no textbox a janela aberta, ta assim:

      Mozilla Firefox

      Mozilla Firefox

      Mozilla Firefox

      Mozilla Firefox

      Mozilla Firefox

      Mozilla Firefox

      Projeto vb

      Projeto vb

      Projeto vb....

      Quando , eu gostaria que ficasse assim:

      Mozilla Firefox

      Projeto vb

      só registrasse no textbox quando mudasse, entende?

      Comment


      • Font Size
        #4
        sim eu entendi o problema, só que eu achei que aquele code resolveria.
        não to com muito tempo pra pensar em algo mais viável então tente fazer assim:

        coloque mais uma textbox invisivel e coloque para ela mostrar o nome da janela ativa
        então nessa textbox usando a opçao textchanged, para quando mudar o nome da janela ativa a textbox mudará e coloque no code para adicionar o texto da nova textbox para a que tem o nome das janelas

        ai só vai registrar quando a nova textbox ter o texto alterado
        " Att King Valentine "

        king_valentine@hotmail.com

        Comment


        • Font Size
          #5
          Duvida resolvida!

          Comment

          X
          Working...
          X