PDA

Click to See Complete Forum and Search --> : a few questions


gamesguru
Jun 24th, 2007, 04:37 PM
EDIT:express edition,2005
first-pause, in other words do nothing, like this.
messagebox.show("a");
pause for 1000 milliseconds
show a new messagebox

basically, just wait a set amount of time then preform a new command

second-pause and external process, such as notepad.
i want to be able to pause an external process in the same way that the command:
system.thread.threading.sleep(int in milliseconds);

pauses itself
thanks for the help.

ComputerJy
Jun 24th, 2007, 05:17 PM
to pause your program you can use:System.Threading.Thread.Sleep(2000);
And I don't think the second part is doable in managed code

gamesguru
Jun 24th, 2007, 05:35 PM
you completely mis-understood me...i want to pause an EXTERNAL process, like notepad or pinball...and i've seen it done,in managed code, in delphi or pascal or whatever it's called.
the second part is just simply do nothing for a set amount of time so...
messagebox.show("a");
wait 2000 milliseconds
messagebox.show("b");

so that would allow you to click the "a" messagebox while waiting for the b.

ComputerJy
Jun 24th, 2007, 05:44 PM
I'm not really familiar with delphi or pascal but if my background knowledge is correct.. They compile into unmanaged code

gamesguru
Jun 24th, 2007, 05:54 PM
so you're telling me that there's no way to do either of these in c#...

ComputerJy
Jun 24th, 2007, 07:40 PM
I really don't know
but I think that if there is a way it'll be using unmanaged code within your app

jmcilhinney
Jun 24th, 2007, 07:46 PM
Manipulating external programs is almost universally done using unmanaged code. You could create a C# app to do it but it would require that your app call unmanaged code, i.e. Windows API functions. If you want to know how to declare external functions in C# code then we can tell you, but what functions to call is really a question for the API forum.

As for your first request, I can only assume that there's more to it than meets the eye given that you demonstrate an existing knowledge of the Thread.Sleep method in the same post. MessageBoxes can't dismiss themselves, nor can they be dismissed in code. If you mean that you want a MessageBox to display for 1 second then disappear and another be shown it's not possible. You would have to design your own form to display in the first place so that you could code a Timer to close it after 1 second.

gamesguru
Jun 24th, 2007, 08:23 PM
ok thanks for the first part, but you mis-understood me also, lets say that i want to send a keystroke, sendkeys.send(keys here);
then delay 1000 milliseconds, without pausing the thread. in simple words i need to, well, nothing for 1 second. then send another keystroke.
one of my friends said that this was an api function. but i was wondering if it can be done without one.

jmcilhinney
Jun 25th, 2007, 05:19 AM
I think you'll find that, rather than our misunderstanding your question, you just didn't explain properly. If you want to do something at an interval then use a Timer. Do whatever, start a Timer, then do whatever when the Timer's Tick event is raised. You can specify the Interval and you can either let the Timer run or Stop it after the first Tick.