Hi again,

I'm really trying to get VB 2005. I want to use sendkeys. The example given by Microsoft is:

VB Code:
  1. Dim ProcID As Integer
  2.         ' Start the Calculator application, and store the process id.
  3.         ProcID = Shell("CALC.EXE", AppWinStyle.NormalFocus)
  4.         ' Activate the Calculator application.
  5.         AppActivate(ProcID)
  6.         ' Send the keystrokes to the Calculator application.
  7.         My.Computer.Keyboard.SendKeys("22", True)
  8.         My.Computer.Keyboard.SendKeys("*", True)
  9.         My.Computer.Keyboard.SendKeys("44", True)
  10.         My.Computer.Keyboard.SendKeys("=", True)
  11.         ' The result is 22 * 44 = 968.

The code works. If I modify this example to:
VB Code:
  1. Dim ProcID As Integer
  2.         ' Start the Calculator application, and store the process id.
  3.         ProcID = Shell("c:\windows\notepad.EXE", AppWinStyle.NormalFocus)
  4.         ' Activate the Calculator application.
  5.         AppActivate(ProcID)
  6.         ' Send the keystrokes to the Calculator application.
  7.         My.Computer.Keyboard.SendKeys("22", True)
  8.         My.Computer.Keyboard.SendKeys("*", True)
  9.         My.Computer.Keyboard.SendKeys("44", True)
  10.         My.Computer.Keyboard.SendKeys("=", True)
  11.         ' The result is 22 * 44 = 968.

(opening notepad instead of calc) it still works. however, If I try to do something that would actually have some real world use:
VB Code:
  1. Dim ProcID As Integer
  2.         ' Start the Calculator application, and store the process id.
  3.         ProcID = Shell("C:\Program Files\Mozilla Firefox\firefox.exe", AppWinStyle.NormalFocus)
  4.         ' Activate the Calculator application.
  5.         AppActivate(ProcID)
  6.         ' Send the keystrokes to the Calculator application.
  7.         My.Computer.Keyboard.SendKeys("22", True)
  8.         My.Computer.Keyboard.SendKeys("*", True)
  9.         My.Computer.Keyboard.SendKeys("44", True)
  10.         My.Computer.Keyboard.SendKeys("=", True)
  11.         ' The result is 22 * 44 = 968.

The AppAtivate line halts the Program with:
System.ArgumentException was unhandled
Message="Process '3380' was not found."

Of course 3380 is the value returned from the shell call. I don't get it. Someone PLEASE exlain why this code doesn't work.