Click to See Complete Forum and Search --> : Pausing a program and doevents


bcyde
February 4th, 2000, 12:44 PM
I just want a little help and clarification about making a program pause and wait for other processes to finish and using doevents. I want to program a loop that pauses to make sure that that all the pending events that are caused by the previous step in the same loop are finished before proceeding further. Specifically I have a loop that sends data using the winsock control and want to wait for the data to be finished transmitting before doing any other processing tasks. Any ideas would be greatly appreciated. I initially thought to use a do while loop with doevents like so:

(...previous code in the for loop)
do while boolean_var = true
doevents
loop
(.. remaining code)



and have the winsock control update boolean_var to false in a separate function when it's finished. My questions are, is this feasible (and optimal), and does doevents work for processes within the same program or does it apply to external processes that windows is running. Thank you,

Cakkie
February 4th, 2000, 12:56 PM
try this:


dim sCount as integer

'...some code, including the start of the for loop
for t=1 to IDontKnowHowMuch
winsock1.senddata "your data here"
next t 'or whatever you used
end sub

private sub winsock1_sendcomplete(some parameters)

'keeps track of how many times you have sent something, i case u need this
'would be the value of t in the for loop
sCount = sCount + 1
doThingsToDo(sCount)

end sub

private sub doThingsToDo(tmpCount as integer)

'...some code

end sub




Tom Cannaerts
slisse@planetinternet.be

The best way to escape a problem, is to solve it.

bcyde
February 4th, 2000, 01:09 PM
Thanks for your reply, what have seems good I'll try and implement it.