Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Dear ALL,

 

I am developing the windows application which interacts with one external hardware, with this hardware i have to run a command which perofrms an operation with the hardware. this i am running in the DOS, But actually this should run in back ground(Pageload) mean while i have to show another screen, i am able get run the command but whenever it is running the dos screen is showing and closing i want to avoid showing the dos screen how i can do this

Posted

Not sure exactly what you mean, windows no longer runs ontop of dos, but you can still execute commandline programs.

 

Try this:

 

System.Diagnostics.Process.Start("yourCommandLine.exe /arg /arg /arg");

 

As for talking to hardware running dos, I'd need more information to give you advice.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

If you truely want to run the DOS app in the background while the page is loading, try using a BackgroundWorker Thread.

 

Using an anonymous method:

using (BackgroundWorker worker = new BackgroundWorker()) {
 worker.DoWork += delegate {
   System.Diagnostics.Process.Start("yourCommandLine.exe /arg /arg /arg");
 };
 worker.RunWorkerCompleted += delegate {
   // do whatever you need to do with the values returned from the
   // command line exe.
   Cursor = Cursors.Default;
 };
 worker.RunWorkerAsync();
 if (worker.IsBusy == true) {
 Cursor = Cursors.AppStarting;
 }
}

Posted

This should do the trick:

 

       Dim ExeString As String = "netsh.exe"
       Dim ArgumentString As String = "interface ip set address ""Local Area Connection"" static 192.168.0.83 255.255.255.0"

       Dim DosCommand As Process = New Process
       DosCommand.StartInfo.CreateNoWindow = True
       DosCommand.StartInfo.UseShellExecute = False
       DosCommand.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
       DosCommand.StartInfo.FileName = ExeString
       DosCommand.StartInfo.Arguments = ArgumentString
       DosCommand.Start()

 

 

You can use the following to check if the DOS program has ended:

       DosCommand.HasExited

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...