I'm programming a project that sent a file from computer to phone.
I use BluetoothCLTools-184.108.40.206
programs to discovery and send my files.
There is my code:
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo("cmd","/c"+@"btobex -n"MyPhone" "C:\A.txt"");
p.StartInfo = psi;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = false;
p.StartInfo.ErrorDialog = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
There is no problem when i use Command prom directly, but when start command prom by my code and sending file to phone if i select NO when my phone ask permission to receive file, the program has a error like this:
Problem Event Name=APPCRASH
there is no error when i use
Edited 5-Oct-12 4:15am
I'm not sure about why you would get the APPCRASH and such, but my thought is that anytime you need to instantiate a process like this it would be wise for you to wrap the entire block in a try catch so that when anything unforseen happens in that 3rd party application you can at least deal with it gracefully in your code. I'm not assuming you haven't done this, but I thought it worthwhile to mention just in case.
If you use the try catch you can check for the APPCRASH state and "assume" that the user has selected no. Hopefully for you there aren't more situations that will cause this particular error to occur.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)