|
Specify arguments by setting Arguments property of ProcessStartInfo object and pass it to Process class object
|
|
|
|
|
Thank you for your answer Giorgi.
I tried this way but got error...
pStartInfo.CreateNoWindow = true;
pStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pStartInfo.UseShellExecute = false; //and also tried with Yes
pStartInfo.Arguments = cmdLine;
pStartInfo.FileName = progName;
pStartInfo.RedirectStandardError = true;
System.Diagnostics.Process.Start(pStartInfo);
|
|
|
|
|
What is the actual value of cmdline that you passed?
|
|
|
|
|
The actual command line that I'm passing is:
wzunzip -d -o "c:\sample.zip" "c:\outputfolder"
in C++ I simple has to pass the string to system(cmdLine ) function,
void ExtractZip(CStirng fileName,CString folder)
{
CString cmdLine;
cmdLine.Format("wzunzip -d -o \"%s\" \"%s\"",fileName,folder);// setting command line
System(cmdLine);
}
|
|
|
|
|
Are all the arguments and parameters correct? What error are you getting? What happen if you run the program which you want to start from cmd with those arguments?
|
|
|
|
|
You are right, Giorgi..
My argument isn't correct.
I found my error and now is working great.
Thanks for your advises and help.
^_^
|
|
|
|
|
You are welcome, glad that I helped you
|
|
|
|
|
Hey,
anyone know the equivalent of VB's MOD, in C#?
Cant find it
|
|
|
|
|
it's the percent symbol:
int n = 10 % 3; n == 1
|
|
|
|
|
|
|
|
|
Daniel Grunwald wrote: Daniel Grunwald
Strangely, I remember trying something on that once and finding that it didn't work, so went back to the developerfusion hosted one. This would have been about a year ago.
Kevin
|
|
|
|
|
Send me a mail if something doesn't work. Note that our converter currently only accepts code that would be valid syntax as a file (whole compilation unit) - this means you can must post whole class definitions, code snippets won't be recognized correctly.
|
|
|
|
|
Daniel Grunwald wrote: Note that our converter currently only accepts code that would be valid syntax as a file (whole compilation unit)
Ah, that would be it then. In that case it would be more useful if it was like the developerfusion version.
Kevin
|
|
|
|
|
OK, I'll try to implement that.
But from a converter, I expect that it gets most things right. Here is a test case that our converter does right, but many others don't:
using System;
public class MyClass
{
string abc;
public string Abc { get { return abc; } }
static void M<T>(params T[] args) where T : IDisposable
{
Console.WriteLine("Hello!");
}
}
Difficulties:
1) realizing MyClass is not a valid identifier in VB
2) renaming abc to not conflict with Abc, since VB is case insensitive
3) not dropping comments
4) supporting generics - .NET 2.0 isn't new anymore in 2007
5) not messing up the ParamsArray parameter
6) noticing M<t>() is a private method because the C# default is private. In VB, it must read "Private Shared Sub" because the default visibility in VB is Public.
All of these at not uncommon in C# code (e.g. "Stop" might be a C# method name, but is VB keyword).
The Telerik converter is quite good (gets all except #2 and #6 right), our converter gets all right (because I created the example based on our unit tests), all others I tested failed miserably.
For SharpDevelop/NRefactory 3.0, I'm looking into making the converter aware of the code semantics - so that VB->C# can get a(1) converted to a[1] or a(1) depending on what a is. And make VB->C# fix up inconsistencies in the casing.
Last modified: 31mins after originally posted -- added difficulty 6
|
|
|
|
|
In my scenario I was:
1. Still using .Net 1.1.
2. Mostly doing C# to VB snippet conversions.
In this scenario, the developerfusion site was adequate enough.
I had been doing C# for a few years before having to work on a VB project.
It would be nice if you could get yours to do snippets though because often we see articles in one language, where we just want to convert a few lines or a method. Often there isn't a full compilation unit presented.
Kevin
|
|
|
|
|
|
I am trying to store strings with embedded escape characters in a resource file, for example:
An error occurred:\r\n{0} However, when the string is retrieved, the escape characters are not read correctly, and I end up with a string such as this:
An error occurred:\\r\\n{0} which is not terribly useful.
According to this[^] article, I can call
String.Replace( "\\r", "\r" ); on the string, but this seems a little silly...
Is this really the "standard" way of storing and managing escaped strings or am I missing something fundamental here?
|
|
|
|
|
|
It's not the escaping characters I'm having a problem with - it's the fact that I can't load them from a resource file without losing the fact that they're "special" characters.
For example, the newline character (\n) becomes two characters, a slash and the letter 'n'. I could run String.Replace on the string to turn it back to something useful, but it shouldn't be translating my string in the first place. Besides, running String.Replace just seems like a huge hack.
VC++ 6 could store and retrieve escaped strings from resource files with no problem, but I can't seem to get it to work as expected in Visual Studio 2005.
|
|
|
|
|
It is not translating your string - it is returning it unaltered. How should it convert \n into newline when it has no idea which programming language you are loading the string from? Not all languages use \n for newline.
Place a newline in the actual XML value. It should work from a technical point of view, but expect to loose it in translation (as in translate to other human languages, not escaping/unescaping). Hard coded newlines really do not belong in anything that should be translated, Make a resource for each line/paragraph instead, or calculate the newline position at runtime.
|
|
|
|
|
hi.
I'm making a contact us form with asp.net 1.1 & C# .
the form has textbox which people can type their name,email and message ...
then they click the "send" button.
I want to recieve their message and name and email in my inbox not in my database!
because I have written the code which can save the message in the database.but it doesnt the thing that I want.!
I want to recieve their message and name and email in my inbox( I mean my email address inbox ).
So,please tell me how to do it ?
thank alot
|
|
|
|
|
You can use the System.Net.Mail.MailMessage class to send yourself an email with all the relevant user contact info as demoed here[^]
|
|
|
|