|
Hi all,
In c# application how can i list the complete detailed information of running background process of a system.
Thanks in advance.
|
|
|
|
|
You can find the complete list with,
Process.GetProcesses();
and then pick the properties of all process such as,
<br />
ProcessName<br />
ID<br />
TotalProcessorTime <br />
StartTime<br />
etc<br />
Please check spellings for all properties above. Read the documentation about the Process as well.
After that actually it's matter of control/use/display them as you wish.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi.. try this code..
using System;
using System.Diagnostics;
class MainClass
{
public static void Main()
{
Process[] allProcs = Process.GetProcesses();
foreach(Process proc in allProcs)
{
ProcessThreadCollection myThreads = proc.Threads;
Console.WriteLine("process: {0}, id: {1}", proc.ProcessName, proc.Id);
foreach(ProcessThread pt in myThreads)
{
Console.WriteLine(" thread: {0}", pt.Id);
Console.WriteLine(" started: {0}", pt.StartTime.ToString());
Console.WriteLine(" CPU time: {0}", pt.TotalProcessorTime);
Console.WriteLine(" priority: {0}", pt.BasePriority);
Console.WriteLine(" thread state: {0}", pt.ThreadState.ToString());
}
}
}
}
|
|
|
|
|
Hi,
I have a vewwy simple app which just sits in the system tray while doing its work. When a user double clicks the notification icon, a config window opens and you can edit some settings there. Right now, I have a simple form which will be hidden from the user and show a notification icon when formstate is set to minimized.
private void TrayForm_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon1.Visible = true;
this.Hide();
}
else if (FormWindowState.Normal == this.WindowState)
{
notifyIcon1.Visible = false;
}
}
For some reason, this works under windows xp, in windows7 I have to disable the ShowInTaskbar call, as that causes a stack overflow in the current thread. If I don't use the call, the form is minimized and remains visible on the taskbar, annoying at best.
Any workarounds? (or am I doing something stupid here...?)
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
Your statement is suggesting this.ShowInTaskbar = false; is firing the Resize event again. If that is so, you can break the loop by using if (this.ShowInTaskbar) this.ShowInTaskbar = false; // avoid a Resize avalanche .
PS: Make sure to provide an appropriate comment to prevent someone from simplifying the code and reintroducing the problem.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanx for the tip, will try it out soonish as my harddrive died on me today
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
Does anybody have an idea how to draw an image (like using TextureBrush ) with gradient transparency (like using LinearGradientBrush )?
The only examples I can find on drawing an image with transparency use ColorMatrix to give the entire image a transparency value, which is not what I'm looking for. I guess what I really need is a LinearGradientTextureBrush , which of course doesn't exist. Does anybody have a suggestion on how to accomplish this? I'm out of ideas.
Thanks in advance for any suggestions.
"Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a turd by the clean end" - Unknown
|
|
|
|
|
In case anyone cares. Until I find a nicer cleaner way to accomplish this, I've decided to brute force it pixel by pixel.
For my purposes, the image is meant to be a background image for a range between 0 and 255. This example does the gradient vertically. To do a different direction, I assume anybody who cares can work out the necessary changes. I'll settle for this only because my image will be very small, but I'd still like to find a more elegant solution.
private Image GradientTransparent(Image src) {
Rectangle bmpBox = new Rectangle(0, 0, src.Width, src.Height);
Bitmap bmp = new Bitmap(src);
Graphics g = Graphics.FromImage(bmp);
for (int y = 0; y < bmp.Height; y++) {
int alpha = (int)((float)y * 255f / (float)bmp.Height);
for (int x = 0; x < bmp.Width; x++) {
Color pixel = bmp.GetPixel(x, y);
pixel = Color.FromArgb(alpha, pixel);
bmp.SetPixel(x, y, pixel);
}
}
return bmp;
}
"Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a turd by the clean end" - Unknown
|
|
|
|
|
|
WPF is outside the scope of this project, but I appreciate the link. It does look interesting.
"Political correctness is a doctrine, fostered by a delusional, illogical minority, and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a turd by the clean end" - Unknown
|
|
|
|
|
Hi all,
IN my c# application i want to display the current list of network connection of a system.
How can i do it ?
Thanks in advance.
|
|
|
|
|
Check this[^]
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
|
|
Hello folks,
I have a C# application which contains an interesting function using a SQL command, essentially it goes like this
INSERT INTO Table C (Name)SELECT DISTINCT Name from [Table A]WHERE Name NOT IN (SELECT DISTINCT Name FROM Table B
This runs on 2005 express SQL and works fine, what this does is effectively pull values from one table column which
are not already in another table with the same column and then insert them into a third table.It is a long story.
I need a way to accomplish this in an applicaton being written using SQL CE 3.5 which does not support sub queries on nText data.
LINQ is out of the question as well due to SQL CE.
Any ideas ? All help greatly appreciated, not sure which way to go with this hence posting in C# forum.
|
|
|
|
|
Might help to switch to NVARCHAR , as that's the type that's used to store queryable texts. NTEXT is a large text, more used in full-text searches and less in queries (as they often contain more data, and querying blobs tends to be slow)
I are Troll
|
|
|
|
|
Thanks,
I shall try and get back to you with a result
|
|
|
|
|
So, you can perform each query on it's own, and process the data in your application? Or are you trying to figure out why it doesn't work?
Craigslist Troll: litaly@comcast.net
"I have a theory that the truth is never told during the nine-to-five hours. "
— Hunter S. Thompson
|
|
|
|
|
This query does work when run as a sql command against a 2005 express
database, changing to nvarchar has removed the error due to the type
incompatability, thanks.
However when I ran the command from the app it had legal syntax but no affect ?
So i pasted it into the sql pane and intllisense altered the statement to this
INSERT INTO Table_C<br />
(Name)<br />
SELECT DISTINCT Name<br />
FROM Table_A<br />
WHERE (Name NOT IN<br />
(SELECT DISTINCT Name<br />
FROM Table_B AS Table_B_1))
This SQL command now works, i will have to do some homework on why that change is required for SQL CE 3.5
and not in SQL 2005 express
|
|
|
|
|
Hi all,
I am having one c++ dll and when i am try to add as a reference in c# application it is giving and error.
How can i use it in my c# application ?
Can you suggest me any method instead of using "dllimport and external" methods.
Thanks in advance.
|
|
|
|
|
sarang_k wrote: Can you suggest me any method instead of using "dllimport and external"
methods.
Unless you want to write a C++/CLI implementation of your C++ function, or provide a C++/CLI version to act as a bridge, there is no other mechanism you can use (discounting you providing COM interfaces in your C++ code for your C# to hook into).
The PE header for .NET assemblies is different to the PE header for other libraries, which means that you can't add a none .NET assembly in as a reference.
|
|
|
|
|
Hi guys,
How can I rename my file defined by my string Path?
I want to pass from :
TXTFile_rfcyxt55efrem1fj4sycjv5527-04-2011_17h-4641_0.txt
to
Entite1.txt
ty for u help
modified on Thursday, April 28, 2011 4:47 AM
|
|
|
|
|
|
Hi,
File.Move is good solution also File.CopyTo(olderpath, NewPath) is also well working)
Ty
|
|
|
|
|
file raname using Regex
like this
newfilename = Regex.Replace(fDialog.FileName, "F.NCF", "H.NCF");
|
|
|
|