|
ok, so when you run cmd.exe you can let it print out your systems directory structure... now i'm looking for a way the execute it from within C#, make it store it's results, so i can call it in another function(which already works)... so how do i do that?
tree C:/downloads /A /F c:/contents.txt <-- command in CMD
with this command i would be storing it in a temp file(content.txt) which i would delete later. can this also be stored in a variable?
thx anyone for answering 1 of these questions (any suggestions that would achieve the same without using the tree function are also welcome)
cheers
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|
|
Perhaps you can launch cmd.exe via System.Diagnostics.Process. Send it input via Process.StandardInput to do the tree listing, then get output via the Process.StandardOutput . Don't know for sure if that will actually work, but it's worth a shot.
|
|
|
|
|
Hi,
I have a Form class (Form1) in Which there is a method "Load_TreeView" which papulate the tree as soon as user create a new Fodler.
Now Folder Operation Create,update,delete are defined in a separate Class "Group", Now What I want is to put "Load_TreeView " method in Group Class.
But I am Having trouble with the Load_TreeView Method as it uses the Form Control (TreeView). Is there Any way I can Define this method in The Group Class?
Q@!$3r
|
|
|
|
|
It's actually a bad idea to mix your view and your model. When you have a clear separation, you can change the view or add additional views without having to worry about how they impact the model. If you search the web for the Model View Controller pattern, you will get a clearer understanding of how this works.
This article might help as a starter. Clickety[^]
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I've seen may deployments of System Tray applications that slide a window into view then slide it back off the desktop. If I set a position that is on the desktop and just show it...it works. But if I set it below the taskbar location ( this.Top = Screen.PrimaryScreen.Bounds.Bottom ) and then place a Windows.Forms.Timer to a 100 millisecond loop to move the position and Show() the form again, no animation of the screen move occurs. It looks like I may have to do a Win32 call to send a 'move form' message to the form but that is beyond my knowledge right now. Has anyone done an animation like this that can give me good direction for getting this to work??
Thanks
|
|
|
|
|
|
Hello!
I'm trying to do a program that logs all the key presses of the keyboard. The application runs smooth (VisibleInTaskBar = false, Visible = false), but, by doing that, i lose the focus on my form. So, i would be interested if there is a way to "intercept" the key strokes from code. I've searched www.pinvoke.net -> and found this: GetKeyState, but, unfortunately, i wasn't able to implement this.
I've also searched the articles, still... nothing relevant to this ... GetKeyState method or ways to implement it.
Thanks a lot,
Catalin David.
|
|
|
|
|
why not create a windows service project? I think this should do the trick.
|
|
|
|
|
drc_no1 wrote: I'm trying to do a program that logs all the key presses of the keyboard.
What key presses do you want to log; only those of your application or system-wide?
"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
|
|
|
|
|
System-wide, that's the problem. Because on the application would be quite easy. But i don't know how to implement it system-wide.
Thanks a lot!
|
|
|
|
|
How can the contents of an assembly be viewed?
Thanks...
Vasini
|
|
|
|
|
Try Lutz Roeder's .NET Reflector[^].
Or, programatically, look up "Reflection" on MSDN.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
you can view the assembly contents using the ildasm which will be available in the start menu but if you want to use the contents you should do programatically using the "Reflections"
venu gopal
|
|
|
|
|
I have a XML file and I´d like to show only some collums at DataGrid.
I thought it:
dataGrid1.DataSource = ds.Tables["Aluno"].Columns["nome"];
but it doesn´t work!!
Please help-me!!!
|
|
|
|
|
How can I tell that my system is connected to the Internet??
Please advice
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
Thank you Rizawn
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I've seen people create StreamWriter objects a couple ways when looking around for info:
<br />
<br />
StreamWriter sw;<br />
<br />
sw = new StreamWriter(filePath);<br />
sw = File.CreateText(filePath);<br />
<br />
What's the difference between those two? Thanks.
"I took the liberty of fertilizing your caviar." -Zoidberg
|
|
|
|
|
This is the implementation of File.CreateText(string):
public static StreamWriter CreateText(string path) {
if (path == null) {
throw new ArgumentNullException("path");
}
return new StreamWriter(path, false);
}
and this is the implementation of StreamWriter(string, bool) that is uses:
public StreamWriter(string path, bool append) : this(path, append, StreamWriter.UTF8NoBOM, 0x400) { }
and this is the implementation of StreamWriter(string):
public StreamWriter(string path) : this(path, false, StreamWriter.UTF8NoBOM, 0x400) { }
So, they are two different paths to the exact same place.
---
single minded; short sighted; long gone;
|
|
|
|
|
I'm trying to send numbers over the serial port as bytes, not strings.
What I mean is if I want to send a 255, that should be 1 byte, not a 2
followed by a 5 and a 5. I'm trying to convert a borland c++ app.
This is what the c++ app does
int8B = 255;
WriteFile(serialPort,&int8B,1,&bytesWritten,NULL);
int8 = gainSlider->Position;
WriteFile(serialPort,&int8,1,&bytesWritten,NULL);
int8 = offsetSlider->Position;
WriteFile(serialPort,&int8,1,&bytesWritten,NULL);
int8 = exposureSlider->Position;
WriteFile(serialPort,&int8,1,&bytesWritten,NULL);
Here is what I'm doing that does not work
int x = 255;
sp.WriteLine(String.Format("{0}", x));
sp.WriteLine(String.Format("{0}", trackBar_Gain.Value));
sp.WriteLine(String.Format("{0}", trackBar_Offset.Value));
sp.WriteLine(String.Format("{0}", trackBar_Exposure.Value));
How do I send the 255? I can't do sp.WriteLine(255) since it wants a
string.
any help will be greatly appreciated.
Ringo
|
|
|
|
|
You could try to build a string that holds the right bytes (using Encodings and stuff),
but then why bother; under NET 2.0 SerialPort class has the method
public void Write (byte[] buffer, int offset, int count);
that AFAIK will do what you need.
Luc Pattyn
|
|
|
|
|
1. casting:
Foo foo=(SomeType)myFooishObject;
vs.
Foo foo=myFooishObject as Foo;
2: type comparing:
if (foo.GetType()=="Foo")
vs.
if (foo is Foo)
Under which situations would you use one or the other options for #1 and #2, and why?
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Hello Marc,
Marc Clifton wrote: Foo foo=myFooishObject as Foo;
This is my solution for #1 and #2. (for #2 followed by "if (foo!=null)"
Marc Clifton wrote: and why?
"as" never throught an exception and prevents me of making double Type compares.
All the best,
Martin
|
|
|
|
|
I'd go with option B for each. In case 1 it avoids a possible exception for invalid cast. In case 2 it avoids the string comparison and the fat finger syndrome.
only two letters away from being an asset
|
|
|
|