|
if your app uses threads, and does not handle IsBackground correctly, older versions of your app might still be running, preventing the latest instance from functioning properly.
|
|
|
|
|
Hi ,
two notepad are running one is saved as first.txt other is saved as second.txt how to kill only one process first.txt
I am using the following code which is closing all the notepad
foreach (Process pre in Process.GetProcesses())
{
if (pre.ProcessName.StartsWith("notepad"))
{
pre.Kill();
}
}
Regards,
Amit Patel
|
|
|
|
|
Find the main window of the process first,
next get the caption of window,
check your condition, if it's satisfy then kill that process...
|
|
|
|
|
You can do that by checking Process.MainWindowTitle property.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
what about this
Process[] pro = Process.GetProcessesByName("Notepad");
pro[0].Kill();
|
|
|
|
|
this is way i m not getting the saved file name
|
|
|
|
|
I'm not sure what you mean with this.. But if you're having trouble closing the correct notepad process, try keeping the Process's Id in memory (knowing the Id of the first and the second notepad process). Then you are sure to close the right one..
|
|
|
|
|
hello all:
i have an application what i want to do in it is, i want to change the url so no user could see the parameters for example the url is www.CodeProject.com/Page.aspx?Id=Xmdwdr
Where Xmdwdr is an encryption
What i want the client to see is www.CodeProject.Com
Could any one help me with it
|
|
|
|
|
There is a lot of information right here[^] about URL rewriting.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Please don't spam the whole damn site.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
No problem its just that on that forum there was no answer and it was the JS forum where i think the answer should be so i thought will there could be a solution using code behind or something
|
|
|
|
|
|
Do you have a programming question ? This doesn't look like one to me.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
need help with a regex that would split a given fullname to its corresponding
first name, last name, middle initial
im trying to emulate outlook's way of breaking down the full name to its corresponding
fields.
any regex or class to do this? help is highly appreciated.
Life - Dreams = Job
TheCardinal
BenPOS Systems
|
|
|
|
|
If you have name as "FirstName MiddleName LastName", just split it over space. Not sure how will you manage in case first name itself contains space.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
thanks, that's what i did but the one you've pointed out thats where my
problems begin
i just really need a regex or something to really isolate what i want to
be extracted and it would not matter if the user enters some of this format's.
lastname, firstname mi.
firstname 2ndname mi. lastname
i really wanted to have a result just like how outlook used a single
textbox for fullname, and breaks it down to its specific fields.
i dont like to implement IF's and Switch's, i think there a better solution
in splitting or extracting the fields
Life - Dreams = Job
TheCardinal
BenPOS Systems
|
|
|
|
|
I think a regex is going to be horribly complex, and even then won't work everywhere:
France: M. Pierre De Gaul
US: Dr M Jones
Japan: Surname first?
Ireland: Shaemus O'Connor
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Even that will not help. If first name can have a space, why can't middle name have one? Or even the last name?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
so whats the best way then?
maybe i will just use 3 textbox separating the 3 fields
and labeling then with the proper labels
hopefully there could be a better solutions for this.
Life - Dreams = Job
TheCardinal
BenPOS Systems
|
|
|
|
|
i have made a line and i update its end points in a loop ...basically to make a circle ... now what a wants is that when a line is made the previously created line should be deleted ?
need help plzz ?
i have tried dipose ??
|
|
|
|
|
previously created line must be draw again using background color.
|
|
|
|
|
First of all, wrong forum... but never the less
How are you trying to draw?
The right way to do it is firstly create a DoubleBufferedPannel . To do that create a new cs file in your solution and add the following code in there.
namespace DoubleBufferPanelNameSpace
{
public class DoubleBufferPanel : Panel
{
public DoubleBufferPanel()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw,
true);
this.UpdateStyles();
}
}
}
compile your project and the you'll see the DoubleBufferPanel in your toolbox. Drop that on the form you want to draw on.
Then to do your GDI code all you have to do is use the panels paint handler like so
private void doubleBufferPanel1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Brushes.Black), 0, 0, 10, 10);
}
If you want the image to be redrawn cause some of the variables that affect the drawing has changed you can call doubleBufferPanel1.Invalidate(); which forces the control to be redrawn.
Using this aproach there is no need to worry about disposing graphics objects as its done for you.
Hope this helps
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
hEY THANKS
I really cant understand why u made a new class ? i directly pasted a PANEL on the forum .
My main issue was not disposing ... my main issue was to erase previously created graphics .. ?
|
|
|
|
|
Two reasons. Every time a control needs to be redrawn by the OS it's OnPain't gets called. Creating your own class derrived from the control in question (Panel) gives you access to this method so you can guarantee your code is going to get called every time it is needed.
Doing it this way, you get a Graphics object for free. No need to use more resources and no need to remember to dispose of it.
A proposal for a slight improvement to Harvey's code:
public class DoubleBufferPanel : Panel
{
public DoubleBufferPanel()
{
this.SetStyle(
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.DoubleBuffer |
ControlStyles.ResizeRedraw, true);
this.UpdateStyles();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (Pen pen = new Pen(Color.Black))
{
e.Graphics.DrawLine(pen, 0, 0, 10, 10);
}
}
}
|
|
|
|
|
If your drawing changes it will flicker and that's no fun... The extra class basically enables double buffering on the panel control and that eliminates the flickering.
Lets have a look at your OnPaint event handler code and see what we can come up with. And how would you like to erase these previously created graphics? What exactly are you trying to write?
The more info you give the better we can understand your problem
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|