|
Process.Start() and its overloads are the way to create a new process. Which is exactly what you're doing with nbtstat -A. You can do something like:
Process.Start("nbtstat -A " + textBox1.Text);
The problem is, of course, getting the output from that. You won't be able to do it. So what you want to do instead is create a process like so:
Process proc = new Process(); proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.FileName = "nbtstat"; proc.StartInfo.Arguments = "-A " + textBox1.Text;
That tells the Process class that you want to redirect stdout so that it doesn't go to the console. After you do that, you can do this:
string output = proc.StandardOutput.ReadToEnd(); proc.WaitForExit(); textBox2.Text = output;
The docs mention that you have to call ReadToEnd() on the output stream before you call WaitForExit() because a deadlock condition could occur the other way 'round.And finally, put the output in textBox2. Just make sure textBox2 is a multiline textbox.
Once you wanted revolution
Now you're the institution
How's it feel to be the man?
|
|
|
|
|
THANK YOU!!!! ![Big Grin | :-D](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
Ok I finally Got this to work
Here is the code I used:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Process p = new Process();
StreamWriter sw;
StreamReader sr;
StreamReader err;
ProcessStartInfo psI = new ProcessStartInfo("cmd");
psI.UseShellExecute = false;
psI.RedirectStandardInput = true;
psI.RedirectStandardOutput = true;
psI.RedirectStandardError = true;
psI.CreateNoWindow = true;
p.StartInfo = psI;
p.Start();
sw = p.StandardInput;
sr = p.StandardOutput;
err = p.StandardError;
sw.AutoFlush = true;
sw.WriteLine("nbtstat -A " +textBox1.Text);
sw.Close();
textBox2.Text = sr.ReadToEnd();
textBox2.Text += err.ReadToEnd();
|
|
|
|
|
|
Click the view details button, and show us some of that
|
|
|
|
|
Maybe the query didn't return anything.
Or try using a DataTable instead of a DataSet.
|
|
|
|
|
|
Hi
How can i get the dimensions (height/width) of a dc from PaintEventArgs.Graphics?
cheers
|
|
|
|
|
Graphics.ClipBounds or PaintEventArgs.ClipRectangle
|
|
|
|
|
does anyone know how to use a scanner with a adf using twain or isis? i also woundering if i could scan using my software not the software that came with the scanner because right now when i use twain from my program it opens the software that came with the scanner to control the scanning process i want to be able to do that with my program
Thanks,
Chad Aiena
|
|
|
|
|
Hi,
Use interop to access the twain com object for this purpose:
[DllImport("twain_32.dll", EntryPoint="#1")]
If you want me to create a tutorial walking you through the process of using this technique, please send me a note through the website: www.KYNOU.com
I hoped I helped ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Does anyone know if there exists a decent API that allows wrapping of the most common GUI APIs?
I'm not very comfortable with WinForms, but I can't switch to WPF yet. I'm considering writing my own widget system, or using wx.NET, but either way I'd like to keep as much of my code as possible - regardless of the underlying API.
The wrapper should have functionality for analyzing a WinForms designer.cs file and creating a common format XML file from it (preferrably XAML-oriented).
|
|
|
|
|
|
You mean as an intermediate description format? Yes, MyXAML would probably work. But I hope to find a wrapper that can act as a proxy API for (the most common features of) any GUI system.
I.e., when I create a ProxyAPI.Button, a button from the selected provider API will be created (be it WinForms, wx.NET, CEGUI, WPF or whatever).
|
|
|
|
|
Why not show "+" in TreeList?
My code:
TLNode tln1 = new TLNode(1, treeList1.Nodes, "name1", "123"); Ok!
treeList1.Nodes.Add(tln1);
TLNode tln2 = new TLNode(2, treeList1.Nodes, "name2", "123"); Ok!
treeList1.Nodes.Add(tln2);
TLNode tln3 = new TLNode(3, treeList1.Nodes[0].Nodes, "name3", "123"); not show
treeList1.Nodes[0].Nodes.Add(tln3);
TLNode tln4 = new TLNode(4, treeList1.Nodes[0].Nodes, "name4", "123"); not show
treeList1.Nodes[0].Nodes.Add(tln4);
public class TLNode : TreeListNode
{
String Title;
String Url;
public TLNode(int id, TreeListNodes owner, String title, String url) : base(id, owner)
{
Title = title;
Url = url;
}
...
}
Please help.
|
|
|
|
|
try inserting to the tln1 the tln3 and 4, and not to the treelist...
eg.
TLNode tln1 = .....
...
...
tln1.Nodes.Add(tln3)...
...
|
|
|
|
|
This code don't show all item
TLNode tln1 = new TLNode(1, treeList1.Nodes, "name1", "123");
TLNode tln2 = new TLNode(2, tln1.Nodes, "name2", "123");
tln1.Nodes.Add(tln2);
// treeList1.Nodes.Add(tln1);
TLNode tln3 = new TLNode(3, tln1.Nodes, "name3", "123");
tln1.Nodes.Add(tln3);
TLNode tln4 = new TLNode(4, tln1.Nodes, "name4", "123");
tln1.Nodes.Add(tln4);
And this code show 1 item "name1", and "+" don't show.
TLNode tln1 = new TLNode(1, treeList1.Nodes, "name1", "123");
TLNode tln2 = new TLNode(2, tln1.Nodes, "name2", "123");
tln1.Nodes.Add(tln2);
treeList1.Nodes.Add(tln1);
TLNode tln3 = new TLNode(3, tln1.Nodes, "name3", "123");
tln1.Nodes.Add(tln3);
TLNode tln4 = new TLNode(4, tln1.Nodes, "name4", "123");
tln1.Nodes.Add(tln4);
My be write same code for me, please. I don't know how to do this.
I have VS 2005 + MSDN(+DevExpress) but i am russin. My english is weak(feeble).
Thank you ever so much.
-- modified at 14:10 Saturday 20th May, 2006
|
|
|
|
|
May be my class have error?
public class TLNode : TreeListNode
{
String Title;
String Url;
public TLNode(int id, TreeListNodes owner, String title, String url) : base(id, owner)
{
Title = title;
Url = url;
}
public override string GetDisplayText(object columnID)
{
return Title;
}
public override void SetValue(object columnID, object val)
{
DevExpress.XtraTreeList.Columns.TreeListColumn id = (DevExpress.XtraTreeList.Columns.TreeListColumn)columnID;
switch (id.AbsoluteIndex)
{
case 0:
val = Title;
break;
}
}
public override object GetValue(object columnID)
{
DevExpress.XtraTreeList.Columns.TreeListColumn id = (DevExpress.XtraTreeList.Columns.TreeListColumn)columnID;
switch (id.AbsoluteIndex)
{
case 0:
return Title;
default:
return "";
}
}
}
SetValue have stop point and debuger don't go in this metod after end edit.
May by this is error?
|
|
|
|
|
Hi,
I want to show date format in VS.Net C# default control like this
Day-Month-Year Hours:Minutes AM|PM
i set the control property on custom and add this text to custom format
like this dd-MM-yyyy HH:mm AM/PM but is show values like this
20-05-2006 6:25 A.5/P.5. Please tell me how i solve this problem.
thanks
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
Well, as far as I know, a time with the format HH:mm will give you time in 24-hour format, like 20:05 for example for 08:05 PM. It looks like the M of AM and PM is mistakenly perceived as the M of month. Try putting hh:mm and see what happens. That's all i can think of from the information you gave.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
datetime.Tostring (a , b) ;
a and b change output string to
mm-dd-yy hh:mm:ss
and ....
|
|
|
|
|
dd-MM-yyyy hh:mm tt
For more info about custom date/time format strings take a look at here[^].
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Hi All
I want to add a shortcut of an exe on IE explorer standard button toolbar programmatically using c#. Please help me if any one has any idea to do this task.
Thanks in advance.
Amit
|
|
|
|
|
hi
iam new to c# can any one help me how to connect a tool strip progress bar to a webbrowser similar to internet explorer or other browsers.
thank you
|
|
|
|
|
Microsoft has launched Express Editions.
After download and install you have the opportunity to download their "Build a Program NOW" pdf document.
This document will give you a walkthrough in Chapter 6
modified 1-Aug-19 21:02pm.
|
|
|
|