how to have the code pause and then continue with a key stroke

Reply

Join Date: Sep 2007
Posts: 4
Reputation: nanoscientist is an unknown quantity at this point 
Solved Threads: 0
nanoscientist nanoscientist is offline Offline
Newbie Poster

how to have the code pause and then continue with a key stroke

 
0
  #1
Sep 10th, 2007
I have written my code in VB6.
I would like the code to pause when variable x = 1, and the program will continue when I hit a key or something of that sort.
Could you give me a hand on this?
ThanX
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: how to have the code pause and then continue with a key stroke

 
0
  #2
Sep 10th, 2007
There are different ways to approach this based on your actuall requirement.

-- You can use a timer and make the timer active when x=1 and inactive when its not.

-- else you can use the sleep and then resume when the value of x changes.

Both methods depends on where you use it.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 4
Reputation: nanoscientist is an unknown quantity at this point 
Solved Threads: 0
nanoscientist nanoscientist is offline Offline
Newbie Poster

Re: how to have the code pause and then continue with a key stroke

 
0
  #3
Sep 10th, 2007
Originally Posted by binoj_daniel View Post
There are different ways to approach this based on your actuall requirement.

-- You can use a timer and make the timer active when x=1 and inactive when its not.

-- else you can use the sleep and then resume when the value of x changes.

Both methods depends on where you use it.
Thank you Binoj for the prompt response.
For my code, either if I use the timer or sleep, x will not change by itself unless the program continues again.
Is there a way that sleep can be deactivated by a key stroke? Surprisingly VB6 doesn't recognizes Sleep!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: how to have the code pause and then continue with a key stroke

 
0
  #4
Sep 10th, 2007
See you can use the timer method and activate and deactivate the timer on a key event. To use the Sleep function you have import the API reference in your project.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC