I'm using CreateProcess to launch an email and it's going pretty well.
The only problem im having is that my arguments are causing errors.
My string looks something like this:
(this function calls the proper api below)
CreateProcess("tmail.exe",
"-to \"" + UserEmail + "\" " +
"-subject \"" + subject + "\" " +
"-body \"" + body + "\"");
if the body string has a " or - in it I seem to get some errors. I'm
assuming I should escape them. I tried using \" and \- but that doesn't seem
to be working right.
I read here from this page about the xp shell the following
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx
You can use most characters as variable values, including white space. If
you use the special characters <, >, |, &, or ^, you must precede them with
the escape character (^) or quotation marks. If you use quotation marks,
they are included as part of the value because everything following the
equal sign is taken as the value.
So I tried ^'s and that didn't work either.
Anyone know what the reserved characters are and what the escape character
or sequence is?
Thanks for any help.
----------------------------
[DllImport("Coredll.dll")]
public extern static IntPtr CreateProcess(
string imageName,
string cmdLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
Int32 boolInheritHandles,
Int32 dwCreationFlags,
IntPtr lpEnvironment,
IntPtr lpszCurrentDir,
IntPtr si,
//byte [] si,
ProcessInfo pi
);