473,587 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

shellexecute in C#

Hi,
Is there a same function in .Net as API shellexecute?

Thanks
Nhan
Nov 16 '05 #1
11 81684
Le, Thanh-Nhan,

Take a look at the Process class in the help. I have posted a sample for
you below.

Hope this helps.
------------------

System.Diagnost ics.Process p = new System.Diagnost ics.Process();
p.StartInfo.Fil eName = "cmd.exe";
p.Start();
Nov 16 '05 #2
Thanks

"Brian Brown" <Br********@dis cussions.micros oft.com> schrieb im Newsbeitrag
news:B9******** *************** ***********@mic rosoft.com...
Le, Thanh-Nhan,

Take a look at the Process class in the help. I have posted a sample for
you below.

Hope this helps.
------------------

System.Diagnost ics.Process p = new System.Diagnost ics.Process();
p.StartInfo.Fil eName = "cmd.exe";
p.Start();

Nov 16 '05 #3
Hi,
I have tried with System.Diagnost ics.Process, but in my case it doesn't work.

I want to call
ShellExecute(0, "open", "mailto:in**@xx x.com?body=yyy& subject=wwwwww, 0, 0, 5)
to open the standart email program ..., as when we click on the hyperlinks mailto:in**@xxx .com?body=yyy&s ubject=wwwwww

Thanks
Nhan

"Brian Brown" <Br********@dis cussions.micros oft.com> schrieb im Newsbeitrag news:B9******** *************** ***********@mic rosoft.com...
Le, Thanh-Nhan,

Take a look at the Process class in the help. I have posted a sample for
you below.

Hope this helps.
------------------

System.Diagnost ics.Process p = new System.Diagnost ics.Process();
p.StartInfo.Fil eName = "cmd.exe";
p.Start();

Nov 16 '05 #4
Le, Thanh-Nhan wrote:
Hi,
Is there a same function in .Net as API shellexecute?

Thanks
Nhan


Yeah, System.Diagnost ics.Process class. You can start a program there.

Laimis
Nov 16 '05 #5
Le, Thanh-Nhan,

You can still use the Process class. Try the sample that I have posted
below (watch for line wrap).

I hope this helps.
--------------------

System.Diagnost ics.Process p = new System.Diagnost ics.Process();
string myMail =
String.Format(" mailto:{0}?subj ect={1}&body={2 }","an****@emai l.com", "Subject
Goes Here", "This is the body of the email");
p.StartInfo.Fil eName = myMail;
p.Start();
Nov 16 '05 #6
Thanks for your help.
I have tried your code, but it doesn't work regrettably.

Nhan

"Brian Brown" <Br********@dis cussions.micros oft.com> schrieb im Newsbeitrag
news:59******** *************** ***********@mic rosoft.com...
Le, Thanh-Nhan,

You can still use the Process class. Try the sample that I have posted
below (watch for line wrap).

I hope this helps.
--------------------

System.Diagnost ics.Process p = new System.Diagnost ics.Process();
string myMail =
String.Format(" mailto:{0}?subj ect={1}&body={2 }","an****@emai l.com", "Subject Goes Here", "This is the body of the email");
p.StartInfo.Fil eName = myMail;
p.Start();

Nov 16 '05 #7
but I want to call a standard email programm on the system of users
computer. I don't know which program will be.
In VB 6 I use
sEmail = "mailto:in**@xx x.com?body=yyy& subject=wwwwww"
call ShellExecute(0, "open", sEmail, 0, 0, 5)

ShellExecute will start email program (as Outlook) and open a window for the
email the given informs.

Thanks
Nhan

"laimis" <si*****@iit.ed u> schrieb im Newsbeitrag
news:uQ******** ******@TK2MSFTN GP10.phx.gbl...
Le, Thanh-Nhan wrote:
Hi,
Is there a same function in .Net as API shellexecute?

Thanks
Nhan


Yeah, System.Diagnost ics.Process class. You can start a program there.

Laimis

Nov 16 '05 #8
The example provided was pretty close. All that you need to do in
addition is to tell the process to use ShellExecute. Let me know if
this still doesn't work for you.

string commandText = "mailto:an****@ someemail.com";
System.Diagnost ics.Process proc = new System.Diagnost ics.Process();
proc.StartInfo. FileName = commandText;
proc.StartInfo. UseShellExecute = true;
proc.Start();


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #9
Thanks,
I have tried with UseShellExecute .
It still doesn't work. I think, my email system had a problem, or my .NET is
not installed correctly (???) . When I the code to open a text file, it
works, the file is opened in notepad.

Nhan
"Matt Brooks" <so*****@somewh ere.net> schrieb im Newsbeitrag
news:ej******** ******@TK2MSFTN GP10.phx.gbl...
The example provided was pretty close. All that you need to do in
addition is to tell the process to use ShellExecute. Let me know if
this still doesn't work for you.

string commandText = "mailto:an****@ someemail.com";
System.Diagnost ics.Process proc = new System.Diagnost ics.Process();
proc.StartInfo. FileName = commandText;
proc.StartInfo. UseShellExecute = true;
proc.Start();


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #10

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

Similar topics

0
2555
by: Marcel Sammut | last post by:
Greetings, I am converting a VB6 application to .net and am having troubles trying to print a document directley to the printer. My VB6 app used the API ShellExecute method to accomplish this, however, needed the printer name, driver and port. All which were obtainable using the Printer object in VB6. Now in .net, I've tried using the...
3
5454
by: Wiktor Zychla | last post by:
I have a problem I cannot solve. My application hosts IE activex control. I follow the standard procedure: I just aximp shdocvw.dll. Note that this gives you two files: axshdocvw.dll and shdocvw.dll. And there comes the problem. I reference the libraries from my project. For this to work, I put the libraries in the same directory as the...
1
2306
by: MCzajk | last post by:
Is there a function similar to ShellExecute, which I can hook to when the program is started using Start Menu icon? MCzajk
0
1823
by: the_openFace | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd, string lpOperation, string lpFile,
0
1593
by: the openBack | last post by:
I'm trying to display the shell's property page for various files and I'm using this code: class Win32Shell { // ... other stuff here public static extern Int32 ShellExecute( Int32 hwnd, string lpOperation, string lpFile,
0
1854
by: David | last post by:
We have an mfc application in which we use ShellExecute to launch the browser with an initial web site. {ShellExecute( NULL, "open", "http://www.SomeWebSite.com", NULL, NULL, SW_SHOWNORMAL ) } This always worked without problems until... We have modified the application so that it now contains some managed C++ and C# code (in dll's). ...
4
3419
by: fdmaxey | last post by:
I currently start a target executable written in VB.Net from an application that uses a C-script language. I start the target executable using ShellExecute in the C-script. The target runs fine like this except for the fact that the target can't write to a log file. If I run the target independently of the C-script application, the log...
1
3082
by: bugs bunny via .NET 247 | last post by:
Does anyone have actually used SetWindowsHookEx() to hook upShellExecute() so as to find what application was started bywindows or which folder is currently browsed by explorer. I knowone thing and that is ... Windows uses ShellExecute() to doalmost every task. I need some implementation help. I want to trigger an userdefined function when...
2
10727
by: John Smith | last post by:
Hi, I have an access database form with an image. I'm trying to create an onclick event on the image so that when a user clicks on the image it opens that file with the default viewer the computer is set on. I've searched the web and nothing solid. I did get the following VBA code and it doesn't seem to work. If anyone can help me i'd...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.