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.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "cmd.exe";
Hi, Is there a same function in .Net as API shellexecute? Thanks Nhan
Thanks "Brian Brown" <BrianBrown@discussions.microsoft.com> schrieb im Newsbeitrag news:B92E8086-5FBD-42B6-BB2C-7145CCD15702@microsoft.com... [quoted text, click to view] > 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.Diagnostics.Process p = new System.Diagnostics.Process(); > p.StartInfo.FileName = "cmd.exe"; > p.Start();
Hi, I have tried with System.Diagnostics.Process, but in my case it doesn't = work. I want to call ShellExecute(0, "open", = "mailto:info@xxx.com?body=3Dyyy&subject=3Dwwwwww, 0, 0, 5) to open the standart email program ..., as when we click on the = hyperlinks mailto:info@xxx.com?body=3Dyyy&subject=3Dwwwwww Thanks Nhan "Brian Brown" <BrianBrown@discussions.microsoft.com> schrieb im = Newsbeitrag news:B92E8086-5FBD-42B6-BB2C-7145CCD15702@microsoft.com... [quoted text, click to view] > Le, Thanh-Nhan, >=20 > Take a look at the Process class in the help. I have posted a sample = for=20 > you below. >=20 > Hope this helps. > ------------------ >=20 > System.Diagnostics.Process p =3D new System.Diagnostics.Process(); > p.StartInfo.FileName =3D "cmd.exe";
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.Diagnostics.Process p = new System.Diagnostics.Process(); string myMail = String.Format("mailto:{0}?subject={1}&body={2}","anyone@email.com", "Subject Goes Here", "This is the body of the email"); p.StartInfo.FileName = myMail;
[quoted text, click to view] Le, Thanh-Nhan wrote: > Hi, > Is there a same function in .Net as API shellexecute? > > Thanks > Nhan > >
Yeah, System.Diagnostics.Process class. You can start a program there.
Thanks for your help. I have tried your code, but it doesn't work regrettably. Nhan "Brian Brown" <BrianBrown@discussions.microsoft.com> schrieb im Newsbeitrag news:59170F67-9548-450A-B9BE-3438A2CE77CC@microsoft.com... [quoted text, click to view] > 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.Diagnostics.Process p = new System.Diagnostics.Process(); > string myMail = > String.Format("mailto:{0}?subject={1}&body={2}","anyone@email.com", "Subject > Goes Here", "This is the body of the email"); > p.StartInfo.FileName = myMail; > p.Start();
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:info@xxx.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" <simulai@iit.edu> schrieb im Newsbeitrag news:uQeNF#C8EHA.1408@TK2MSFTNGP10.phx.gbl... [quoted text, click to view] > Le, Thanh-Nhan wrote: > > Hi, > > Is there a same function in .Net as API shellexecute? > > > > Thanks > > Nhan > > > > > > Yeah, System.Diagnostics.Process class. You can start a program there. > > Laimis
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:anyone@someemail.com"; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = commandText; proc.StartInfo.UseShellExecute = true; proc.Start(); *** Sent via Developersdex http://www.developersdex.com ***
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" <someone@somewhere.net> schrieb im Newsbeitrag news:ejTxksm$EHA.4072@TK2MSFTNGP10.phx.gbl... [quoted text, click to view] > 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:anyone@someemail.com"; > System.Diagnostics.Process proc = new System.Diagnostics.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!
You can also call ShellExecute directly through Interop if you wish. <code> //ShellExecute declaration [System.Runtime.InteropServices.DllImport("shell32.dll")] private static extern long ShellExecute(Int32 hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, long nShowCmd); </code> *** Sent via Developersdex http://www.developersdex.com ***
This should work: Process myProcess = new Process(); ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("rundll32.exe" ); myProcessStartInfo.UseShellExecute = false; myProcessStartInfo.Arguments= "url.dll ,FileProtocolHandler mailto:www.microsoft.com"; myProcess.StartInfo = myProcessStartInfo; myProcess.Start(); myProcess.WaitForExit(); myProcess.Close(); Regards, Jeff I want to call ShellExecute(0, "open", "mailto:info@xxx.com?body=yyy&subject=wwwwww, 0, 0, 5) to open the standart email program ..., *** Sent via Developersdex http://www.developersdex.com ***
Don't see what you're looking for? Try a search.
|