Jump to content
Whiteangel

Abrir uma aplicação em VB

Recommended Posts

Whiteangel

Boas pessoal,

Estou a tentar através de um botão abrir a aplicação da calculadora, ele corre, mas quando vou fazer alguma operação nela, da-me erro, tenho seguinte código:

Dim ProcID As Integer
       ' Start the Calculator application, and store the process id.
       ProcID = Shell("CALC.EXE", AppWinStyle.NormalFocus)
       ' Activate the Calculator application.
       AppActivate(ProcID)                          <--- ERRO : O processo '{0}' não foi localizado.
       ' Send the keystrokes to the Calculator application.
       My.Computer.Keyboard.SendKeys("22", True)
       My.Computer.Keyboard.SendKeys("*", True)
       My.Computer.Keyboard.SendKeys("44", True)
       My.Computer.Keyboard.SendKeys("=", True)
       ' The result is 22 * 44 = 968.

Edited by ribeiro55

Share this post


Link to post
Share on other sites
gastao

exprimenta assim,

System.Diagnostics.Process.Start("calc")
ou
System.Diagnostics.Process.Start("C:\Windows\system32\calc.exe")

Edited by gastao

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.