|
Hi,
I'm writing a program to monitor processes in computer. I used class Process in namespace System.Diagnostics. But it seems there no information about the parent process of a process such as id or process_name in this class. So, if i want to know information about the parent process of a process (or child processes of a process), how must i do?
LC
|
|
|
|
|
You can't find it because this relationship doesn't exist. Process cannot have child processes, at least not at the O/S level. A process can launch another process and treat it as a child, but the O/S doesn't recognize the significance.
You can, however, have multiple processes running under the same job object though, so the processes can be managed as a unit. But, that in no way means that every process is running under a job object. A process can be created without a job!
There is no support in the .NET Framework BCL for jobs though, so you'd have to go directly to the Win32 API to enumerate the processes under each job.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks for your answer. I'll use another way (API, as you suggested, maybe)
|
|
|
|
|
Hi, I'm wondering if it's possible at all to detect whether the user has clicked the up or the down button specifically.
Thanks
|
|
|
|
|
I think you can't................
My small attempt...
|
|
|
|
|
Get the keycode of the Key and
Compare it with the UP and Down button Keycode
karthick
|
|
|
|
|
Hey All,
How to collect the Objects? Like an array, how do we collect the objects?
|
|
|
|
|
Do you mean an ArrayList ? Or are you using C# 2.0, then List<object> will do. Replace object with whatever class you want to collect.
This is the sort of question that's bound to be covered by a beginners book, I recommend working through a book if you're serious about learning C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can use ArrayList..............
Just declare like ArrayList objArrayList = new ArrayList();
Them you can add the objects
objArrayList.Add(obj);
My small attempt...
|
|
|
|
|
Hey All,
Thank you very much for your kind help.
so my question is, hwo could i store the objects of a table(which contains 2 columns and 170 rows) in an arrayList?
-- modified at 12:19 Wednesday 18th April, 2007
|
|
|
|
|
You mean you are having objects on each cell...
try the foreach method to retrieve all from that. then use arraylist
foreach(Datarow row from table.rows
{
objarrayList.Add(row["item"];
}
My small attempt...
|
|
|
|
|
Is there a legitimate syntax for declaring a generic class taking multiple generic parameters, specifying constraints on *each* parameter? For instance, VS2005 will not complain about multiple constraint parameters and a *singular* constraint (where) expression:
public class MyGeneric<T1, T2> : Component where T1 : Class1
{
}
But it doesn't want to see the following:
public class MyGeneric<T1, T2> : Component where T1 : Class1, where T2 : Class2
{
}
Does anybody know the syntax for multiple generic constraints?
TIA,
m
|
|
|
|
|
Just omit the comma:
public class MyGeneric<t1, t2=""> : Component where T1 : Class1 where T2 : Class2
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
Wow, thanks!
Funny, you have to comma delimit the new constraint after another constraint...
public class MyCollection<T1, T2> : Component where T1: MyClass1, new() where T2 : MyClass2
...but not the where of the subsequent constraint?
Sure does work. I appreciate the tip.
m
|
|
|
|
|
I have a database application that has a datatable bound to both a DataGridView and some text boxes. The text boxes, collectively, show one row of data. Now, if a user has edited a row and clicks 'Save' in the File menu, I want those changes to be saved. Right now, I'm basing the decision to save or not save a row on whether the DataRowState for that row is 'Modified'. But, if the row the user has edited still has the 'focus', so to speak, the DataRowState is not 'Modified', but 'Unchanged', even if the individual values in the text boxes (to which the data table is bound) have been changed. As soon as I go view another row in the database, though, the DataRowState becomes 'Modified'. Is there an easy way to validate the row without leaving it?
|
|
|
|
|
Just a guess, but you might try calling the EndEdit method on the DataRow prior to checking its DataRowState.
|
|
|
|
|
I thought of that, too, but it did not work. When I googled the problem, I found a solution. Basically, if I call the BindManagerBase.EndCurrentEdit() method, that updates the datatable with any changes that are in progress and changes the DataRowState, as appropriate.
|
|
|
|
|
Has anyone successfully customized the PageSetupDialog - by adding a control or 2 - as outlined in the MSDN help?
MSDN Home > MSDN Library > Win32 and COM Development > User Interface > Windows User Interface > User Input > Common Dialog Box Library >
If so how did you manage it? I can't seem to get it to work and in the MSDN forum I was told it can't be done, which contradicts the MSDN documentation.
(Sometimes I wish we'd stuck to C++)
Thanks in advance.
Happy programming!!
|
|
|
|
|
I'm trying make a simple telnet client to connect to a JTAG tool. I'm displaying the telnet data to a richtextbox. It is coming along but I'm have a problem trying to get the arrows keys to send. Do you know how to treat the arrow keys like any other key and have it call the keypressed event handler?
Thank You for any help or suggestions.
|
|
|
|
|
Hi,
You have to create a new inherited control from RichTextBox and make an override of the "IsInputKey" or "InputKey" method. This method returns a boolean that indicates if the system has to process the key event. Search in MSDN for more info.
|
|
|
|
|
Hi, the term is probably wrong, but this is what I need to do.
I want to make a base class that I cannot create instances of, but holds the prototypes for a bunch of functions. I will subclass from this later and make a real class. is an "interface" what I am looking to use?
For example: I have a method (call it "DoStuff") in a library that takes a "Surface" as one of its arguments. within that method I will evaluate a point on that surface, so "Surface" contains a method GetPoint(u,v). The surface class cannot do any evaluation because it could be a NURBS surface, or maybe an explicit surface, or any other kind that will evaluate differently, so to prevent a runtime bug, I want to prevent anyone from making an instance of "Surface". Instead, I want to create a subclass NurbsSurf : Surface that will know how to evaluate itself at u and v, and I will pass a "NurbsSurf" to "DoStuff", but the "DoStuff" method also needs to accept any other kind of surface that I might create.
Sorry, I know that this is probably a pretty basic question.
Thanks for any help
cb
|
|
|
|
|
You can do this as either an abstract base class
public abstract class Surface{
public abstract void DoStuff() ;
}
or as an interface
public interface Surface {
void DoStuff();
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
probably an interface. There are to differences between an interface and an abstract class is that you can have multiple interface inheritance, but only single class inheritance. The second is that you can't implement any methods in an interface definition, but can implement methods in an abstract class if you wish. For inheritance reasons I generally prefer interfaces. IF you've got a number of common stock methods and only a few that need written uniquely for the inheriting classes the abstract route can however be better.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Thanks for your help.
Sorry for the repeat question.
cb
|
|
|
|
|
dan neely wrote: There are to differences between an interface and an abstract class is that you can have multiple interface inheritance, but only single class inheritance. The second is that you can't implement any methods in an interface definition, but can implement methods in an abstract class if you wish.
The third is that you can publish newer version of abstract class with added concrete method, but you can't extend interface without breaking backward compatibility. IMO important difference for library.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|