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)

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)

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