public void UpdateIcon(DataTable dt) { DBase.AddColumn(dt, "ICON", typeof(Image)); for (int i = 0; i < dt.Rows.Count; i++) { // DBase.SetValue(dt, i, "ICON", Properties.Resources.RemoveBlack); } }
public LanguageList() { InitializeComponent(); this.W1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.BGLoading); this.W1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.BGLoading_Complete); DBase.AddColumn(dt, "ICON", typeof(Image)); DBase.AddColumn(dt, "APPNAME"); DBase.AddColumn(dt, "PATH"); dgv.AutoGenerateColumns = false; }
public static DataTable UseWMIToGetProcesses() { DataTable dt = new DataTable(); DBase.AddColumn(dt, "ProcessId"); DBase.AddColumn(dt, "Caption"); DBase.AddColumn(dt, "CommandLine"); DBase.AddColumn(dt, "ExecutablePath"); string remoteMachine = "localhost"; string queryStr = "select * from win32_process"; ConnectionOptions co = new ConnectionOptions(); co.Username = @"domain\username"; co.Password = "******"; ManagementScope ms = new ManagementScope(string.Format(@"\\{0}\root\cimv2", remoteMachine), null); ms.Connect(); if (ms.IsConnected) { int process_count = 0; ObjectQuery query = new ObjectQuery(queryStr); using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms, query)) { using (ManagementObjectCollection searchResult = searcher.Get()) { foreach (ManagementObject mo in searchResult) { ////PrintProperties(mo); //Console.WriteLine(mo["ProcessId"] + " : " + mo["Caption"]); ////Console.WriteLine(mo["CommandLine"]); DataRow dr = dt.NewRow(); dr["ProcessId"] = mo["ProcessId"]; dr["Caption"] = mo["Caption"]; dr["CommandLine"] = mo["CommandLine"]; dr["ExecutablePath"] = mo["ExecutablePath"]; dt.Rows.Add(dr); process_count++; } } } } return(dt); }
private void BGLoading(object sender, System.ComponentModel.DoWorkEventArgs e) { try { dt = DHuy.SELECT_SQL("SELECT * FROM LANGUAGE"); DBase.AddColumn(dt, "ICON", typeof(Image)); for (int i = 0; i < dt.Rows.Count; i++) { DBase.SetValue(dt, i, "ICON", Properties.Resources.Trans16); } } catch (Exception) { } finally { } } //Action