Utilizando Visual Studio.NET 2005

OlĂĄ pessoal, meu nome Ă© Mauricio Junior, estou disposto a mostrar como chamar programas do windows dentro de um programa Windows Forms como: calculadora, word, excel, windows explorer de uma maneira fĂĄcil e rĂĄpida.

 

Requisitos:
- Framework 2.0 instalado;
- Visual Studio.NET 2005;
- Linguagem C#.NET;
- Ter ou criar um programa do tipo Windows Forms

Livros publicados:


 

Na prĂĄtica

Bom para início de conversa, iremos utilizar o seguinte namespace System.Diagnostics.Process e o método Start para chamar qualquer tipo de programa de dentro do programa Windows Forms.

Segue algumas questÔes do método:

Starts a process resource and associates it with a Process component.

Overload List

 

Name

Description

Process.Start ()

Starts (or reuses) the process resource that is specified by the StartInfo property of this Process component and associates it with the component.

Supported by the .NET Compact Framework.

Process.Start (ProcessStartInfo)

Starts the process resource that is specified by the parameter containing process start information (for example, the file name of the process to start) and associates the resource with a new Process component.

Supported by the .NET Compact Framework.

Process.Start (String)

Starts a process resource by specifying the name of a document or application file and associates the resource with a new Process component.

Process.Start (String, String)

Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component.

Supported by the .NET Compact Framework.

Process.Start (String, String, SecureString, String)

Starts a process resource by specifying the name of an application, a user name, a password and a domain and associates the resource with a new Process component.

Process.Start (String, String, String, SecureString, String)

Starts a process resource by specifying the name of an application and a set of command-line arguments, a user name, password and domain and associates the resource with a new Process component.

 

Na prĂłxima parte Ă© criar um botĂŁo para chamar diretamente a calculadora do windows. (ReferĂȘncia 1.1)


ReferĂȘncia: 1.1

Ao clicar duas vezes no botĂŁo, coloquei o seguinte cĂłdigo: (ReferĂȘncia 1.2)

 

private void toolStripButton5_Click(object sender, EventArgs e)

        {

            System.Diagnostics.Process.Start("calc");

        }

 

ReferĂȘncia: 1.2

 

Executei o sistema e apertei a tecla de atalho, automaticamente foi iniciado a calculadora do windows cujo apareceu na tela. (ReferĂȘncia 1.3)


ReferĂȘncia: 1.3

 

Para chamar outros programas como o word basta fazer da seguinte forma: (ReferĂȘncia 1.4)

 

 

private void toolStripButton5_Click(object sender, EventArgs e)

        {

            System.Diagnostics.Process.Start("winword");

        }

 

ReferĂȘncia: 1.4
 

Chamar o explorer: (ReferĂȘncia 1.5)

 

private void toolStripButton5_Click(object sender, EventArgs e)

        {

            System.Diagnostics.Process.Start("explorer");

        }

 

ReferĂȘncia: 1.5

Chamar o excel: (ReferĂȘncia 1.6)

 

private void toolStripButton5_Click(object sender, EventArgs e)

        {

            System.Diagnostics.Process.Start("excel");

        }

 

ReferĂȘncia: 1.6

 

E assim por diante. Espero ter ajudado qualquer dĂșvida, favor entrar em contato.

MaurĂ­cio Junior

E-mail: mauricio@ascompras.com
Site pessoal: www.mauriciojunior.org
Comunidade: www.aspneti.com