|
Get the process ID (the number) not the name from the other process and kill it.
|
|
|
|
|
but every time i run the process the process id is changed.
how do i know which one is which?
|
|
|
|
|
Process[] processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
foreach(Process p in processes)
{
if(p.Id != Process.GetCurrentProcess().Id)
{
p.Kill();
}
}
|
|
|
|
|
Iam Developing P2p file sharing application using VS2003, I have a list box of all the file names downloaded to my PC, i want to open the file on clicking the filename.
How is it possible?
|
|
|
|
|
System.Diagnostics.Process.Start(@"filepath");
|
|
|
|
|
Thanks a lot,I got the result I wanted.
|
|
|
|
|
hi there
can you please tell me how can i show a message if my app wasn't used for a specific period of time?
i mean how can i determine that my app wasn't used!!?
thanks
-- modified at 21:40 Friday 28th July, 2006
|
|
|
|
|
Use some flags, and set this flag in OnMouseMove or OnKeyDown.
For counting the time you can use timer.
|
|
|
|
|
Thanks but you mean OnMouseMove/OnKeyDown of the form?
What if the mouse was moved over a control, such as a treeview?
Should I handle OnMouseMove/OnMouseMove of all the controls in my form?!
This is not right.
|
|
|
|
|
I have written several services in C#.NET, but this is the first one which is self-installing (I scan the main(string[] args) for the "-i" or "-r" switches to install or remove the service respectively. I would like to give the administrator some indication of the success of the process, but it does not appear that Console.WriteLine() works in a C#.NET service (even when it is invoked in a command shell rather than from svchost.exe).
Am I missing something obvious (it would not be the first time)? Obviously, when the code is running as a service under svchost.exe, it will not have access to any consoles for output. But this is running in a command shell, so shouldn't console output work there?
BTW, this is .NET 1.1 (the "enterprise" does not support 2.0 yet).
Thanks!
gmorse@cox.net
-- modified at 22:05 Friday 28th July, 2006
|
|
|
|
|
Use the eventlog, or create a log file.
|
|
|
|
|
trying to create a generic indexer where the class definition does not have a <T>
psedo code below.
<code>
public myClass{
public T this<T>[ValueType item]{
get{
return null;
}
}
}</code>
other than creating two methods for get and set are there any other solutions? or explinations as to why this would not work
-- modified at 19:07 Friday 28th July, 2006
|
|
|
|
|
You cant use type arguments on property definitions.
|
|
|
|
|
Hi!
Is it possible to redirect the output from Process.Start to a textfile or (even better) a variable?
I'm using Process.Start to invocate ipconfig to get the mac address..
Thanks in advance,
-K
|
|
|
|
|
Use Process Start Info to indicate that the process will redirect its std out, in , and err then on then create a process object with the start info as a parameter. Set event listeners on the process for the 3 streams and viola.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Bien! Just what I wanted. Thanks a million...
-K
|
|
|
|
|
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
//p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "ipconfig.exe";
p.StartInfo.Arguments = ("/all");
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.WaitForExit();
string s = p.StandardOutput.ReadToEnd();
Console.WriteLine(s);
Console.ReadKey();
-K
|
|
|
|
|
Hi,
I am deploying a C# application and along with that, i am also deploying SQL Express. Now i want to create the account for user of that application. Please tell me how can i do that.
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi,
I am having problem in writing the stylesheet using C# code-behind. I have written a code, but it is not affecting my pages. Can any one please tell me how to write... This is the code
/*<![CDATA[*/
#banner { background-image:url../images/banner1.jpg) }
#splash{background-image:url(../images/active_bg.jpg) }
/*]]>*/
and I have written like this....
protected void Page_Init(object sender, EventArgs e)
{
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Href = "~../Css/landing.css";
Page.Controls.Add(link);
HtmlLink linkMain = new HtmlLink();
linkMain.Attributes.Add("type", "text/css");
linkMain.Attributes.Add("rel", "stylesheet");
linkMain.Href = "#banner{ background-image:url(../images/banner1.jpg) }";
Page.Controls.Add(linkMain);
HtmlLink linkSplashButtons = new HtmlLink();
linkSplashButtons.Attributes.Add("type", "text/css");
linkSplashButtons.Attributes.Add("rel", "stylesheet");
linkSplashButtons.Href = "#splash{ background-image:url(../images/active_bg.jpg) }";
Page.Controls.Add(linkSplashButtons);
}
Can anyone please tell me how to write this
Regards
Rukmini
-- modified at 13:27 Friday 28th July, 2006
|
|
|
|
|
I really have no idea what you are trying to do with that code?
Anyway if all you want is a style sheet to affect your page, put this in the markup:
In the header:
<link href="pathToStyleSheet" rel="stylesheet" type="text/css" />
In Body:
<div id="banner">some stuff</div>
<div id="splash">some other stuff</div>
And if you have #banner and #splash in the .css file you load with the <link> tag then the styles will be applied.
-- modified at 13:36 Friday 28th July, 2006
|
|
|
|
|
Sorry ..May be I am not clear in my question
I am working on content management system. It is having a master page,
and all the other aspx pages are having the asp:Content. The content of the aspx pages must appear in the contentplaceholder of the master page. All the aspx pages are having different stylesheets. So for every aspx page I must add the stylesheets in code-behind.
While trying to add the stylesheets from code-behind I am facing problem.
|
|
|
|
|
Ahh I understand now.
Put a Label in the <head> in the MasterPage. Then in the page_load for the .aspx page put something like:
((Label)MasterPage.FindControl("lblStyleSheet")).Text = "<link href='yourStyleSheet.css' rel='stylesheet' type='text/css' />";
|
|
|
|
|
Now this part is working
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Href = "../Css/landing.css";
Page.Controls.Add(link);
the error is..by mistake I have given like this
link.Href = "~../Css/landing.css";
Now for this two I am unable to find out what is the problem.
HtmlLink linkMain = new HtmlLink();
linkMain.Attributes.Add("type", "text/css");
linkMain.Attributes.Add("rel", "stylesheet");
linkMain.Href = "#banner{ background-image:url(../images/banner1.jpg) }";
Page.Controls.Add(linkMain);
HtmlLink linkSplashButtons = new HtmlLink();
linkSplashButtons.Attributes.Add("type", "text/css");
linkSplashButtons.Attributes.Add("rel", "stylesheet");
linkSplashButtons.Href = "#splash{ background-image:url(../images/active_bg.jpg) }";
Page.Controls.Add(linkSplashButtons);
|
|
|
|
|
can anyone please send any intresting miniproject using only c.it should be not too long a maximum of 200lines.waiting 4 reply.plz replysoooooon.
|
|
|
|
|
Sure thing. Here you go. I hope it's not too long. Anything else we can do for you?
void main(){} /ravi
|
|
|
|