Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. AppActivate problem

AppActivate problem

Scheduled Pinned Locked Moved Visual Basic
helplinux
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Here is my code Shell("C:\Windows\Notepad.exe") AppActivate("Sans titre - Bloc-notes") 'French computer ^^ SendKeys("test") Doesn't work. I get an error on the AppActivate line Please help Thanks ~Michael

    D 1 Reply Last reply
    0
    • A Anonymous

      Here is my code Shell("C:\Windows\Notepad.exe") AppActivate("Sans titre - Bloc-notes") 'French computer ^^ SendKeys("test") Doesn't work. I get an error on the AppActivate line Please help Thanks ~Michael

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      OK. First, it helps if you supplied what the error was. Without that, we just speculating as to what is wrong. What your doing is problematic at best. If the system launches another app or dialog, or the user clicks anywhere between the time the AppActivate and SendKeys statements are run, (and, YES it DOES happen!), your keystroke will end up going to another application. Now... At first glance, the title of the application your activating doesn't match the title of any window. What you can do in place of the title is use the TaskID that is returned by the Shell function and use that in the AppActivate statement. On top of that, when you launched Notepad, it was launched, by default, minimized. To correct that:

      Dim taskID as Long
      taskID = Shell("C:\Windows\Notepad.exe", vbNormalFocus)
      AppActivate taskID
      SendKeys "test", True

      RageInTheMachine9532

      A 1 Reply Last reply
      0
      • D Dave Kreskowiak

        OK. First, it helps if you supplied what the error was. Without that, we just speculating as to what is wrong. What your doing is problematic at best. If the system launches another app or dialog, or the user clicks anywhere between the time the AppActivate and SendKeys statements are run, (and, YES it DOES happen!), your keystroke will end up going to another application. Now... At first glance, the title of the application your activating doesn't match the title of any window. What you can do in place of the title is use the TaskID that is returned by the Shell function and use that in the AppActivate statement. On top of that, when you launched Notepad, it was launched, by default, minimized. To correct that:

        Dim taskID as Long
        taskID = Shell("C:\Windows\Notepad.exe", vbNormalFocus)
        AppActivate taskID
        SendKeys "test", True

        RageInTheMachine9532

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Worked. Thanks!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups