dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Capture name of running program.

  1. #1
    Join Date
    Feb 2010
    Posts
    1

    Capture name of running program.

    Hello guys,

    I am developing a program in VB 6.0 that has one function that capture the name of the main window running.

    Ex: User opens the my program and minimize it ...
    Even minimized the program know the name of the window that the User is using: Firefox, Google Chrome, My Computer, etc. ..

    Well, this is already done.

    Screenshots:
    - http://img685.imageshack.us/img685/9783/ss1hv.jpg
    - http://img695.imageshack.us/img695/9449/ss2kg.jpg

    But I want know when the User change of window!
    Ex: Get out Firefox and go to My Computer.

    >> Look my module:
    Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Public Declare Function GetForegroundWindow Lib "user32" () As Long

    Public TituloJanela As String 'Contem o titulo da janela


    >> My code
    Private Sub Timer2Ok_Timer()

    If PegarTituloJanela Then
    lblJanela.Caption = TituloJanela
    End If

    End Sub


    -- Time2Ok Properties
    Enabled: Ture
    Interval: 2


    Okay, there is the following ...
    It will display the name of the main window in use.

    But I want every time that user change the window...
    Came a msgBox!

    But I have no idea how to do this. : /

    If anyone can help me I'll be very happy.

    Thanks.


    PS: Sorry my bad english. :X

  2. #2
    Join Date
    Apr 2009
    Posts
    394

    Re: Capture name of running program.

    You will have to use a timer and continually check the foregroundwindow...



    Good Luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)