473,385 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Run Command from a Windows Form

I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the Start->Run
Command.

I am have a link in a ListView for "Open Containing Folder", I want to open
the page using windows explorer is there a way to Run("explorer.exe
c:\folder\")?

Also, Is there anyway to focus on an existing window if one is already
created.
Feb 7 '06 #1
2 4493
Ben,

I don't know about focusing on the existing window. For that, you
might have to cycle through the open windows, and maybe query the text of
the windows.

However, in order to open a the containing folder, you would want to use
the Process class, and then pass the name of the directory as the process to
execute. You have to also set UseShellExecute on the ProcessStartInfo
instance to true, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ben Dewey" <As*********@hotmail.com> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the Start->Run
Command.

I am have a link in a ListView for "Open Containing Folder", I want to
open the page using windows explorer is there a way to Run("explorer.exe
c:\folder\")?

Also, Is there anyway to focus on an existing window if one is already
created.

Feb 7 '06 #2
> I have what I believe is probably a simple question...

Is there any programatic way to launch a program similar to the
Start->Run Command.

I am have a link in a ListView for "Open Containing Folder", I want to
open the page using windows explorer is there a way to
Run("explorer.exe c:\folder\")?

Also, Is there anyway to focus on an existing window if one is
already created.


Don't know about focusing. I doubt that it's built into the framework though.

To start a process have a look at System.Diagnostics.Process.Start
Feb 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
5
by: Jarod | last post by:
Hey I have already written a program that has a user interface, but I would like to add some command line interface too. So if the user run it like: program.exe paramater1 The program do...
4
by: Francesco Martinelli | last post by:
I need to create a multiple file assemby: this requires working directly with the command line compiler (no IDE support!). After a few tests I found my problem comes from the issue described below....
4
by: Primo | last post by:
Hi, This problem has been frustrating me for days and I hope you experts can help me out. I am trying to run a command, which I would normally run from the command line, from within my C#...
0
by: January Smith | last post by:
When I run the code below after creating an Empty .Net type project and adding an Empty C++ file it always opens a command window before displaying the form. If I write a similar VB application by...
3
by: Tim | last post by:
Hi, I am trying to pass a SQL Command, complete with parameters and their values from one form to a modal form. The modal form has; public void...
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
3
by: Tomas Andersson | last post by:
So here is my problem I have a program written in VB9 that I wanted to add a file reference to textfile renamed .spf. In the file there is stuff on every row that the program does something about....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.