Click here to Skip to main content
15,914,070 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i know how to create thread but i dont know how to controll this using keyboard keys.

On pressing ‘t’ thread 1 should start and show movement on upper left corner of screen

On pressing ‘t’ second time, thread 2 should start and show movement on upper right corner of screen

On pressing ‘x’ thread 1 should stop.

On pressing ‘x’ second time thread 2 should stop.
Posted
Updated 29-Oct-10 0:32am
v2
Comments
Rajesh Anuhya 29-Oct-10 6:25am    
No Effort..
arslan3488 29-Oct-10 6:31am    
ok tell me what this whole thing called so i can search on internet
Radhakrishnan G. 29-Oct-10 6:53am    
You can handle KeyPress event if its a Windows Form Application,
Otherwise try with Keyboard Hook
kadaoui el mehdi 29-Oct-10 7:24am    
what kind of application do you use ?

1 solution

When you want to show these kind of stuff on a web page you must use javascript on the client. You can use setTimeout to mimic somekind of threading functionality. Each time you enter the given method, this is some sort of time slice for that thread (in a somewhat cooperative fashion).

Have a look here for an example:
"http://www.sislands.com/coin70/week3/bball.htm[^]

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900