|
May u explain this ,how to handle
|
|
|
|
|
at the end of the thread give a callback (or/and event) that will alert the main thread that the serach thread has finished
|
|
|
|
|
How to get programatically list of application currently opened in operatin system?
|
|
|
|
|
using System.Diagnostics;
...
Process[] aProc = Process.GetProcesses()
This will give you the currently opened applications...
|
|
|
|
|
Hi All,
While working with plotting in EMF format i am getting a strange problem. On executing the C# code that creates a Graphics object for metafile, the EMF automatically gets deleted as after all processing,the metafile Graphics object is disposed. If we don't dispose, then the metafile created is somewhat corrupted as none of the viewer opens it. Actually i am plotting a display by drawing lines. When i plot more then 2500 such lines, this scenario occurs. Why is this happening?Is there any workaround for this?
Thanks in advance,
Regards
Chandra
|
|
|
|
|
Hi All,
I am looking for plotting support in C#. I am working with EMF(Enhanced metafile) files. My application can send the output to an EMF file but alternatively, i want to have some mechanism to send the output directly to plotter. On similar pattern to as .Net provide some API's for printing , are there any API's available in .Net or some third party API's available for plotter?
Thanks in advance,
Regards
Chandra
|
|
|
|
|
Hi
I am developing an application for making data flow diagrams in c#, i can move around objects and also draw lines from one point to another, but the problem is that once the lines are drawn and then i move other objects around the lines get erased for obvious reasons how to get rid of that?
Sameer Sood
Microsoft Student partner
NIT Durgapur,India
|
|
|
|
|
That is because you are drawing on the screen where the control happens to be instead of using the control to do the drawing.
Use the Paint event of the control to do the drawing. Then whenever the control has to be redrawn for any reason, the lines will also be redrawn.
Store the coordinates of the lines to draw in a list or something. Add coordinates to the list and use the Invalidate method on the control to make it redraw itself.
---
b { font-weight: normal; }
|
|
|
|
|
i knw that and i hv done it
the problem is that it's a reversible line and this is done using controlpaint. this line is drawn only w.r.t. a form and not a control as far as i kinw, so hw to do that, to make it simple let us say u re drawing a line like mspaint, hw to handle that sort of line?
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
plz dnt us txtspk in 4rm, it mks psts v.hrd 2 rd
|
|
|
|
|
If "u" "hv" done it that way, what is the problem? Whenever a part of the form needs repainting, it will first draw it's background, then "ur" event handler for the Paint event will draw the lines on top of it. It doesn't matter how "u" draw the lines, as they will always "b" drawn from the same state.
If "u" "re" drawing a line like mspaint, "u" "wd" "b" drawing it on a bitmap, then displaying the bitmap.
---
b { font-weight: normal; }
|
|
|
|
|
hi
First do it then answer me, imagine a scenario where 5 or ten lines are there, and also 5 or 6 controls object on the same board which you can move with mouse,so first question
how will you know which line to refresh or redraw, the even if u redraw then the flickers are so high that it doesn't look nice, plus then as i said it's reversible lines , so when some part of it is missed and then i redraw, that missed part gets erased permanently, it's easier said than done my friend , pls try it.
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
Yes, as you are using reversible lines you have to redraw everything around a line when you are moving it, so you will have some flickering. You can specify a rectangle for the Invalidate method to make it redraw only the needed part of the control.
---
b { font-weight: normal; }
|
|
|
|
|
ya i know about that , how will i detect that which line to redaw among so many lines, this is the main problem how to get the rectangle at the right place
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: how will i detect that which line to redaw among so many lines
Eh? Are you unable detect what line you just changed yourself?
---
b { font-weight: normal; }
|
|
|
|
|
Not that, i mean lines are there, but as i move other objects (not lines), then they may move over any of the line may be one or more, how to detect that, u need to redraw then.
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
I am still a very inexperienced coder, so this might be a stupid question, but here it goes.
I am developing a website that has a membership login component. New users need to enter their username and email address. I then generate a random password for them. The problem comes in here, I need to send this password to them with some unique link for them to click on to verify that their email address is valid.
Generating the password and sending the email I can do, the problem is the link. I have no idea where to even start. How do I generate it and how do I verify it once the user clicks on it?
Daniel Oosthuizen
----------**************---------
ps. This is what part of the alphabet would look like if q and r were eliminated.
|
|
|
|
|
Well, you need to create an aspx webpage which takes a url parameter which identifies the user who is verifying.
So, on registration generate your random password, and a second random large password. Add the link to the email pointing to your webpage with the second password eg.
http://www.mywebsite.com/Authorise.aspx?Verification=9DFG45NN4NG80003GVN3N5
When the user clicks the link, you can collect the second password you generated from the aspx webpage and presumably look it up in your database to determine which user is being authorised.
Make any sense?
Regards,
Rob Philpott.
|
|
|
|
|
Thanks for the reply.
Most of what you said I had figured out already, but I didn't know the correct syntax for retrieving the value from the url. A friend pointed me in the right direction, but thanks again for replying anyway.
Daniel
|
|
|
|
|
Hi
I devloped a application.Every time clicking on .exe a instance is opened of that application.How this is possible that single instance run of this application
|
|
|
|
|
Hy,
Use the Process.GetProcessesByName(processname) class to see if another process with the same name is running.
Hope it helps.
Do your best to be the best
|
|
|
|
|
This is not the best way to do it, it's quite error prone.
The correct way is to use a Mutex and check if it exists.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
There are some articles here on CP covering this topic. Simply search the artciles for "single instance application".
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
This is the code your looking for.
[STAThread]
static void Main()
{
Process instance = RunningInstance();
if (instance == null)
{
Application.Run(new AteGui(splashScrn));
}
else
{
HandleRunningInstance(instance);
}
}
<big>Helper Functions and DLL imports</big>
public static Process RunningInstance()
{
Process current = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(current.ProcessName);
foreach (Process process in processes)
{
if (process.Id != current.Id)
{
if (Assembly.GetExecutingAssembly().Location.Replace("/", "\\") ==
current.MainModule.FileName)
{
return process;
}
}
}
return null;
}
public static void HandleRunningInstance(Process instance)
{
ShowWindowAsync(instance.MainWindowHandle, WS_SHOWNORMAL);
SetForegroundWindow(instance.MainWindowHandle);
}
[DllImport("User32.dll")]
private static extern bool ShowWindowAsync(
IntPtr hWnd, int cmdShow);
[DllImport("User32.dll")] private static extern bool
SetForegroundWindow(IntPtr hWnd);
private const int WS_SHOWNORMAL = 1;
|
|
|
|
|
As has been stated before, iterating through a process list is not a good idea because of several reasons (with being slow the least one).
Mutexes are the way to go!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|