Hey,
I have a problem with a small program that I want to make. It's a script that keeps running by using a Do While loop. I want to stop the script when a certain key is pressed. But the problem is that the keypress sub isn't working because the other sub keeps running. Is there a way of doing this, or is there someone who knows how to replace the do while with the use of a timer or someting, so that I can make a pause between every run of my script.
Thanks already
4 1811 kadghar 1,295
Recognized Expert Top Contributor
Hey,
I have a problem with a small program that I want to make. It's a script that keeps running by using a Do While loop. I want to stop the script when a certain key is pressed. But the problem is that the keypress sub isn't working because the other sub keeps running. Is there a way of doing this, or is there someone who knows how to replace the do while with the use of a timer or someting, so that I can make a pause between every run of my script.
Thanks already
hmmm, try with DoEvents.
HTH
I don't have any experience with that :-s, And I looked on google know but the first pages I found all used DoEvents with visual basic.Net. But is it also working in VB 6, because then I will continue my search.
But s small other question, can I vb executable close another running executable, because otherwise a make a small exe with only the keypress and the code for closing the other program. And in the other program, I just start the second program in the begin. Is this possible and how do I do this, because I can start something with shellexecute but i don't know how to close something.
thanks already fr you're fast support.
kadghar 1,295
Recognized Expert Top Contributor
I don't have any experience with that :-s, And I looked on google know but the first pages I found all used DoEvents with visual basic.Net. But is it also working in VB 6, because then I will continue my search.
But s small other question, can I vb executable close another running executable, because otherwise a make a small exe with only the keypress and the code for closing the other program. And in the other program, I just start the second program in the begin. Is this possible and how do I do this, because I can start something with shellexecute but i don't know how to close something.
thanks already fr you're fast support.
yes it's possible, but its easier using DoEvents
Lets make a little example.
create a label with caption = 1 and write: -
private sub Label1_click()
-
do
-
label1.caption = label1.caption +1
-
doEvents
-
loop
-
end sub
that will make the label increase its value as crazy when you click on it but you still can work with the rest of the form. That's what DoEvents is for. To do something else while a process is running.
then just put a command button with something like - private sub command1_click()
-
end
-
end sub
and you're done
HTH
Really thank you a lot, you're not only giving me the solution, but also explaining me in short what all things do.
Thanks a lot!!!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Bart Nessux |
last post by:
Can Python be used to stop windows services? I'm writing a script to
automaically remove some troublesome Symantec software, but before
running the main removal script, I need to kill some...
|
by: Mark |
last post by:
Hi,
At the top of my php file I have got :-
<body onblur="self.focus();">
so when I click off onto another window, my window comes back up in front
which is perfect. The problem however, is...
|
by: Dave |
last post by:
I have a situation where I want to react to a ctrl-click on a <span> and
it works in Netscape and Firefox browsers but in IE I have a problem.
In IE I do catch the ctrl-click but IE also renders...
|
by: ern |
last post by:
I have a program that runs scripts. If the user types "script
myScript.dat" the program will grab commands from the text file, verify
correctness, and begin executing the script UNTIL...
I need...
|
by: dfaber |
last post by:
Aloha!
I want to terminate a process/program from within a python script.
For example,
if I have a program say foo.sh that starts running, then I can run it
from within a python script using...
| |
by: brian |
last post by:
i broke down where i think the problems areas would be.
any help would be greatly appreciated.
where the file is called
<script type="text/javascript" src="k.js">
</script>
the beginning...
|
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= |
last post by:
I have an application that is designed for using with a bar code scanner. I
want the user to know that the scan was complete and the data was entered, so
I am playing a system sound after data...
|
by: tolkienarda |
last post by:
hi all
i am trying to stop people from entering anything but numbers into a textbox.
i have the code to make sure they have entered a number on each keypress event and now a msgbox appears if they...
|
by: Steve |
last post by:
Hi All,
I've been trying to come up with a good way to run a certain process
at a timed interval (say every 5 mins) using the SLEEP command and a
semaphore flag. The basic thread loop was always...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |