Results 1 to 4 of 4

Thread: Program List Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Question Program List Help

    I recently asked a question on how to get a current application list and have discovered a small problem with it for what I want to do.
    http://www.vbforums.com/showthread.php?&p=2876018

    The problem is when you find a program like in notepad its called something like
    "name - notepad"
    which makes a problem when you save it under another name making it called something like
    "newname - notepad"
    (not closing it or reopening it)
    I'm wondering if I can make it when I click the app
    "name - notepad"
    it will stay with that app even if I save it under another name or if there is more than one notepad running.

    Hope you understand what I mean....

    And is there a way to check if an application is running using and if stament...?

    Thanks,

  2. #2
    Lively Member Moneybucks's Avatar
    Join Date
    Apr 2006
    Location
    Kingston Upon Thames -UK
    Posts
    123

    Re: Program List Help

    There is a way to check if an application is running, but you would need to use an API to do it. I have used them in the past, but can't find the projects that I used them in, try asking in the API forums.
    If, somehow, I help you, please rate the post using the scales icon in the left bar <---- .

    Please Use Naming Conventions in your projects! ------\/
    http://www.visibleprogress.com/vb_na...onventions.htm

    Me to Brother
    -Hey, look at this avater I made in about 5 seconds
    -What, morrisons?
    -AGHHHHHH

  3. #3
    Lively Member Moneybucks's Avatar
    Join Date
    Apr 2006
    Location
    Kingston Upon Thames -UK
    Posts
    123

    Re: Program List Help

    Hang on, this one looks useful:

    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    
    Private Sub Form_Load()
    
    hWindow = FindWindow(vbNullString, "Notepad")
    
        If IsWindow(hWindow) = 1 Then 'Code for if program is running.
    
    End Sub
    This requires a hardwired in set of apps though, there is an API for checking processes, which you could compare to a list of processes that you stored in a .TXT file for a more efficient and flexible solution.
    If, somehow, I help you, please rate the post using the scales icon in the left bar <---- .

    Please Use Naming Conventions in your projects! ------\/
    http://www.visibleprogress.com/vb_na...onventions.htm

    Me to Brother
    -Hey, look at this avater I made in about 5 seconds
    -What, morrisons?
    -AGHHHHHH

  4. #4
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Program List Help

    Don't forget to declare hWindow as Long

Posting Permissions

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



Click Here to Expand Forum to Full Width