Results 1 to 7 of 7

Thread: Alternative AppActivate Code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    Alternative AppActivate Code

    Hey everyone, the name pretty much says it all, I need a more reliable code then AppActivate that does the same thing. I need it to activate a program I tell it to, perferribly without calling the process id. Thank you much in advance.

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Alternative AppActivate Code

    What problems are you having with AppActivate? Without knowing the issue you are having, how can we know what will help.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    Re: Alternative AppActivate Code

    It does not always find the program i specified, it will return cannot find process 0. I use AppActivate("Notepad") or AppActivate("Untitled - Notepad") It will work ocassoinally and then randomly give that error. It doesn't matter which one i use.

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Alternative AppActivate Code

    Does AppActivate give you the error, or are you using the result in another call, which is giving you the error?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    Re: Alternative AppActivate Code

    it is appactivate, it will ocassionally bring the window into focus but ocassionally it will give me that error.

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: Alternative AppActivate Code

    Try something like this.
    Code:
            For Each p As Process In Process.GetProcessesByName("notepad")
                AppActivate(p.Id)
            Next
    Now "notepad" in this case is the process name, not the value from the title bar.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Aug 2009
    Posts
    21

    Re: Alternative AppActivate Code

    Hmmmm, i am surprised that works, i am in a class for vb6 programming and have been using a for next loop and did not realize you could use this, I will continue to use it, Thank you much. Credit will be given to you in my final programs.

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