If WMI is an option for your tool you can get all that information from it. Just take a look to the class "Win32_Process". I remember some nice articles about WMI in codeproject. If you don't find them let me know.
Jose Fco Bonnin
Posts
-
Process Owner and Parent -
Custom PanelYou can create a new class A inheriting from Panel adding the next lines of code. After that all the classes inheriting from A will have again the design view.
[Designer(typeof(System.Windows.Forms.Design.DocumentDesigner),typeof(System.ComponentModel.Design.IRootDesigner))] public class A : System.Windows.Forms.Panel { .... } ... public yourpanel : A { .... }
-
STRING MANIPULATIONif you use @"\d+" and your string is "aaaa1" the result will be true.
-
how to avoid referencesI type mismatched the last line should be "anInterface.Method();" instead of "IAnInterface.Method();" it was evident but .....
-
Images, SQL and C# -PLEASE HELPYou can convert it to a byte[] before send to the server and then store it directly. public StorePhoto(byte[] photoContent) { ....... SqlParameter param1 = new SqlParameter("@photo",SqlDbType.Image); param1.Direction = ParameterDirection.Input; param1.Value = photoContent; ....... }
-
STRING MANIPULATIONWhat about using regular expressions? Something like: public bool IsNaturalNumber(string sValue) { return (Regex.IsMatch(sValue, @"0*[1-9][0-9]*") && !Regex.IsMatch(sValue,@"[^0-9]")); }
-
how to avoid referencesYou can use reflection to load an assembly.
Assembly a = Assembly.LoadFrom("your.dll"); Type t = a.GetType("namespace.classname"); MethodInfo m = t.GetMethod("method"); object o = Activator.CreateInstance(t); object result = m.Invoke(o,new object[]{parameters});
If you want to avoid call methods in this way, you can also create an interface with all the necessary information about the dll and when you call CreateInstance just cast to it. For instance:public interface IAnInterface { void Method(); } ....... IAnInterface anInterface = (IAnInterface)o.CreateInstance(atype); IAnInterface.Method();
-
Properties PageHi, I'm creating an application that uses the windows media encoder SDK. I would like to show the properties/configuration pages of the input devices like wmenc.exe does. This dialog is custom for every device installed but I'm sure that there is an standard way to show it. Any idea/suggestion will be apreciated. Thanks
-
Welcome dialog when app starts?I'm sorry if I'm offended you I didn't want to criticize your code. What I'm saying is if that guy wants to show a form during the load of the real application, in my opinion is better to show it in a different thread because it guarantees that the form will be shown and you will not get a blank screen because the application is busy doing other things. But of course you can also use tricks like Refresh() or Application.DoEvents() doesn't matter.
-
Welcome dialog when app starts?If you do a Thread.Sleep the rest of the application will not be loaded. Why don't you try something like that
public class Form1 : System.Windows.Forms.Form { .... Form2 frm= new Form2(); public Form1() { Thread thread = new Thread(new ThreadStart(StartForm2)); thread.Start(); // Do your stuff frm.Close(); } private void StartForm2() { if (frm != null) frm.ShowDialog(); } .... }
-
How To Add Carriage Return Char To a String, Anyone?Try with Environment.NewLine
-
can i embed internet explorer in my application?Yes, you can do it in some ways, the easiest one is customizing the toolbox and adding from the COM Components tab, the "Microsoft Web Browser" (\system32\shdocvw.dll), then you just need to drag it to your form. To get more information about how to use it check this link http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/browser\_control\_node\_entry.asp
-
DataGrid - C# Windows Forms - How to not Allow a 'new' record added to end of gridYou need to set it in the data view
((DataView)((CurrencyManager)this.BindingContext[dataGrid1.DataSource,dataGrid1.DataMember]).List).AllowNew = false;
-
how to receive html element eventsTake a look to this article http://www.devhood.com/tutorials/tutorial\_details.aspx?tutorial\_id=312
-
Node searching in TreeViewHere are a little approach ...
public TreeNode Search(TreeNodeCollection col) { // Create an enumerator for the collection. IEnumerator myEnumerator = col.GetEnumerator(); TreeNode node = null; while(myEnumerator.MoveNext()) { System.Console.Out.WriteLine(((TreeNode)myEnumerator.Current).Text + ": "+ ((TreeNode)myEnumerator.Current).FullPath); if ( ((TreeNode)myEnumerator.Current).FullPath == textBox1.Text) // Make the right comparision return ((TreeNode)myEnumerator.Current); else { node = Search( ((TreeNode)myEnumerator.Current).Nodes ); } } return node; } private void button1_Click(object sender, System.EventArgs e) { TreeNode node = Search(treeView1.Nodes); if (node!=null) { treeView1.SelectedNode = node; treeView1.Select(); } }
I hope that it helps. Greetings, Jose. -
Save a File from VariantHello, I have an ATL object which loads a JPEG from database in a VARIANT now I need to save the variant to a file on disk. Any idea? Thanks.
-
VARIANT and Byte ArraysHello to everybody. I'm making a COM object which receive a VARIANT type, I recover this value from database in an ASP page as a Byte Array (it's a bitmap), the COM object must draw something over this bitmap and send again to the ASP page. My problem comes because I need extract the data from the VARIANT in a CLongBinary* but I haven't idea how can I do it. Can you help me? Thanks.
-
Only one application instanceHi, I would like to check if there is running any instance of my application, in order to set the focus on it if the user try to start a new one. Any idea? Thank you.
-
Customize message from datagridHello, I've a datagrid with a dataset wich I get from a WebService. When I insert, update, etc there are some messages that I want customize (null value not allowed, duplicate key, etc). This messages are created "locally" before to send modifications to the database, but I don't know how to catch it before show it in order to customize. Any idea or suggestion? Thank you.
-
Calling a C++ DLL from C#The first thing that I've made was read the article, It's a good article where I found how to avoid the problem of load the dll and the method but my actual problem is that I can load and detect the method but this don't return nothing. I don't know what it's happening.