The name 'SetControls' does not exist in the current context

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
private string executeOtherAPI(string command, string parameter)<br/>
{<br/>
// command is the name of excutable file like cmd.exe <br/>
string output = String.Empty;<br/>
string direct = string.Empty;<br/>
string fileName = string.Empty;<br/>
int indexer = command.LastIndexOf(@"");<br/>
if (indexer != -1)<br/>
{<br/>
direct = command.Substring(0, indexer + 1);<br/>
fileName = command.Substring(indexer + 2, command.Length - indexer - 2);<br/>
}<br/>
else<br/>
{<br/>
return "Incorrect Input"; ;<br/>
}<br/>
SetControls.setAccessRule(direct);<br/>
string action = command;<br/>
System.Diagnostics.Process proc = new Process();<br/>
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo();<br/>
myProcessStartInfo.RedirectStandardInput = false;<br/>
myProcessStartInfo.UseShellExecute = false;<br/>
myProcessStartInfo.RedirectStandardOutput = true;<br/>
myProcessStartInfo.Arguments = parameter;<br/>
myProcessStartInfo.CreateNoWindow = true;<br/>
myProcessStartInfo.FileName = fileName;<br/>
myProcessStartInfo.WorkingDirectory = direct;<br/>
proc.StartInfo = myProcessStartInfo;<br/>
try<br/>
{<br/>
proc.Start();<br/>
output = proc.StandardOutput.ReadToEnd();<br/>
myProcessStartInfo.RedirectStandardOutput = false;<br/>
}<br/>
catch (Exception ex)<br/>
{<br/>
output = ex.Message;<br/>
return output;<br/>
}<br/>
return output;<br/>
}
Source: http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/9d56e68f-84da-4b22-8b4c-d19aa9a8b62b" target="_blank
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/9d56e68f-84da-4b22-8b4c-d19aa9a8b62b


If it makes a difference I have this in a windows form...
<
Im sorry if I misspelled something or my grammar is wrong, Ive never done well in those subjects.
<br/>

View the full article
 
Back
Top