How To Stop Or Pause A Function And Restart It From The Point Where Stopped?
Is there a simple way in Visual BAsic to Stop a function and then again start from the point it was stopped?
Example
User presses Start->
Start_OnClick()
Function 1 Function 2 Function 3
User presses Next ->
and Function 4 Function 5
should be continued...??????
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- STOP Or PAUSE The SUB Or FUNCTION.
- Stop / Restart A Vb App
- Start, Stop, Restart Services
- Break/Pause Point Not Show?
- Stop/Start/Restart Sites And Services On IIS
- Stop && Pause
- Trying To Stop My Program (Pause)
- Play, Stop, Pause, Etc Buttons
- Stop/pause/play With Media Player
- How To Stop The Process Copy, Pause And Resume?
- Date Function Has Stopped Working
- Insturction Pause , Delete , Stop In Visual Basic 6
- Making A Label Stop Moving When It Hits A Certain Point[solved]
- How Can I Stop And Restart/start My Timer Control Or Timer Api Used In My Programe
- Stop An Application Resizing, Past A Certain Point, Flicker Free? [slvd]
- Shell Function (Restart Computer)
- Pause Function??
- Better Pause Function?
- Pause Function
- Pause Function
- How To Pause A Function?
- Pause A Function
- Trouble With Pause Function
- Pause Function? [SOLVED]
- Pause, Wait, Or Sleep Function?
- Small Problem With A 'Pause' Function.
- Proxy Checker Pause Function
- Need A Pause Type Function - Updated
- Trying To Create A Generic Timer/pause Function
- Pause Untill Private Function Finishes?
- Play, Stop, Pause, Loop Play MP-3
- The Point Function
- Point Function
- Point Function
- Do ListImages Have A Point Function
- .Point Function In Direct X?
- Function To Cut The Floating Point Value
- The Break Point Function
- What Is The Point Of The Call Function?
- Function To Find And Angle Of A Point?
- A Function To Point To Specific Form
- Point In Region Function...what Is Wrong With My Code
- How To Draw Point And Line(any Built-in Function?)
- What Would Stop A Public Function Being Seen?
- Stop ReadFile Function !!
- VB && Excel - How To Stop A Function
- [HELP] Button To Stop Executiong Function??
- Function Won't Stop... Even After It's Form Is Unloaded!
- Stop Application While Function Runs
Stop / Restart A Vb App
I understand this request is not an ideal solution to my problems but never the less it is a solution.
I have a VB app using a 3rd party SDK which is where the problem is. The SDK can exhibit memory leaks so I would like to schedule my vb app to terminate and restart at least once a day to flush away any leak problems...just like that...
Is there a proven way of stopping the vb app and restarting it...I thought about services but vb doesn't 'seem' to lend itself gracefully to writing services..
or..
The app could simply terminate itself..then another app restarts it..but you are then reliant on the other app..
Any suggestions?..Many thanks
Start, Stop, Restart Services
How do I start, stop, or restart services in Microsoft Common Console in Windows 2000/XP ? I often turning on or off some services there and need to make a shorter way.
Break/Pause Point Not Show?
For some reason unknown to me, my VB6 is not highlighting the code of the last Execution Point when I press Pause/Break while the app is run. anyone know why it's doing this? I'm trying to debug my coding and its hard when I can't see were the last process was after hitting pause. It's only doing it on this coding app. All my other coded apps show the yellow highlighted points
Stop && Pause
what i am trying to do is make it so when u user clicks the "Start" button, it will do something, but then there will also be "Stop" and "Pause" buttons. how can i make it so when the user clicks the "Stop" button, it will stop doing the command the "Start" button gave, and same thing with pressing pause only i can pause it, and then be able to resume it. i hope this isn't too confusing, and makes sense.
-ThX
Trying To Stop My Program (Pause)
I've written a program and I would like the ability to stop everything the program is doing and wait until a start button is clicked.
Can anyone help me on this???
Play, Stop, Pause, Etc Buttons
Hi there i am trying to manage a number of video files using standard buttons:
Play
Stop
Pause
Skip Forward
Skip Back
I am having big problems!, i can see to get the video to start, but im not sure it is correct, it is using the DoVerb method.
Can anyone help me please?!?!?!?
Alex aka. VB Idiot
Stop/pause/play With Media Player
im using mediaplayer control in my vb.. when i use the code
VB Code:
wmPlayer.Controls.pause
and
VB Code:
wmPlayer.Controls.stop
and press the play, they work the same..
all i want to happen is when i pause, it resume the playing.. when i press stop, it totally stop the playing time..
How To Stop The Process Copy, Pause And Resume?
I have success make a copy file from drive to drive, but how to do when the copy file is in progress and i want to terminate it.?
here is my some coding:
start copy:
Private Sub CmdCopy_Click()
Dim i
Dim r
Dim lngHandle As Long, SHDirOp As SHFILEOPSTRUCT, lngLong As Long
Dim Ft1 As FILETIME, Ft2 As FILETIME, SysTime As SYSTEMTIME
Dim dValue
On Error GoTo Handler
r = Right(Dir1.Path, 1)
If r <> "" Then
CopyFile CDBox.FileName, Dir1.Path & "" + CDBox.FileTitle, 0
Else
CopyFile CDBox.FileName, Dir1.Path + CDBox.FileTitle, 0
End If
'Reset progressbar value to zero
ProgressBar1.Value = 0
'set progressbar max value to the value in the text box
'ProgressBar1.Max = Text1.Text
'Duh!
Timer1.Enabled = True
'assign variable the current percentage value for the progressbar
Percentage = getPercentage(ProgressBar1.Value, ProgressBar1.Max)
'call the BeginProgress to set the start time for the progressbar
BeginProgress
'Call the TimeRemaining function and display it in label1
Label1.Caption = "TimeLeft " & TimeRemaining(Percentage)
dValue = FileLen(CDBox.FileName)
For i = 1 To dValue
DoEvents
ProgressBar1.Value = i / dValue * ProgressBar1.Max
Next i
Exit Sub
Handler:
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description, vbOKOnly, "Error"
End Sub
stop copy:
Private Sub CmdStop_Click()
'Halt Procedure
Timer1.Enabled = False
ProgressBar1.Value = 0
Label2.Caption = "Percentage 0%"
Label1.Caption = "TimeLeft 00:00:00"
Label4.Caption = "ProgressBar value: 0"
End Sub
module:
Dim sStart As String
Function BeginProgress()
'Call this when you begin th progressbar
sStart = Now
End Function
Function TimeRemaining(CurrentPercentage As String) As String
Dim maxTime As String
Dim sRemaining As String
Dim Mins As String
On Error GoTo Handler
'determine how much time(in seconds) has passed since the progress bar has started
maxTime = DateDiff("s", sStart, Now)
'make sure percentage is above 0%
If CurrentPercentage > 0 Then
'calculate how many seconds until progressbar is finished
sRemaining = Val(maxTime / CurrentPercentage) * Val(100 - CurrentPercentage)
'convert seconds into Minutes:Seconds format
Mins = Format(Fix(sRemaining / 60), "00")
'set return variable to have Minutes:Seconds left and also Hours
TimeRemaining = Format(Fix(Mins / 60), "00") & ":" & Format(Mins Mod 60, "00") & ":" & Format(sRemaining Mod 60, "00")
End If
Exit Function
Handler:
TimeRemaining = "Error"
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description, vbOKOnly, "Error"
End Function
Function getPercentage(ProgressBarCurrentValue As String, ProgressBarMaxValue As String) As String
'calculate Percentage completed of progressbar
getPercentage = Format(Val(Val(ProgressBarCurrentValue / ProgressBarMaxValue) * 100), "0")
End Function
Date Function Has Stopped Working
I have the following line of code that has just stopped working all of a sudden. Can anybody tell me why??
DTPicker1 = CDate(Date)
It doesnt like the Date bit. Do I need to enable a componenet again or something??
Making A Label Stop Moving When It Hits A Certain Point[solved]
I have a long Label, it shows text, I want it to scroll slowly, but how do I make it stop at a certain point, If I do
VB Code:
Private Sub tmrAbout2_Timer() DoEvents LblAbout.Top = LblAbout.Top - 10 DoEventsIf LblAbout.Top <= 0 Then tmrAbout2.Enabled = FalseEnd Sub
Then it stops when the top of the label hits the top of the form/frame, I want it to scroll through the top of the frame, Its fine if I dont put an If then but it keeps going forever.
Shell Function (Restart Computer)
Hi Ppl
i have created a programme as college work but i have a minor problem i need to create a button that when pressed restarts the computer i have tried many types of codes and have even tried just shell(windows directory) but with me being on a network i dont have access to windows directory to know where it is.
I need a piece of code that i can put into my project to log off my computer of a network at the click of a button if you can help me please do as i need this as urgent as possible LAST RESORT !!!!!
Thanks
Pause Function??
Is there a pause function? I want to run a program and then after it runs, pause for a few minutes and then run it again.
Better Pause Function?
Hi,
I been using this pause function for a while
Code:
Public Sub Pause(Length&)
Dim Time As Long
Time = Timer
Do
DoEvents
Loop Until Timer - Time >= Length
End Sub
The problem with this function is that after the application is running for more than two days+, it sometimes gets stuck on the loop. This doesn't always happen but it does happens. So my question is, Is there a better pause
function that wouldn't get stuck and serve the same thing as this?
thank you
Pause Function
Already another question
I have a pause function, but is there anyway i can make it pause until there a specific condition is fulfilled. For example:
Pause Function:
VB Code:
Public Sub Pause(ByVal Float As Single)If Float > 10 Then StopFloat = Timer + FloatWhile Float >= Timer DoEventsWendEnd Sub
I am trying to make it pause until instr theres "Continue"
i tried, but it didnt work
my try:
VB Code:
Public Sub Pause(ByVal Float As Single)On Error Resume NextDim Data As String Dim i As Integer Data = wb.Document.body.innerhtmlIf Float > 10 Then StopFloat = Timer + FloatWhile InStr(1, Data, "Continue") DoEventsWendEnd Sub
If anybody could help me with this I would greatly appreciate it
Or if anybody could figure out another way to accomplish this my total code is:
VB Code:
Private Sub Command4_Click()On Error Resume NextFor i = 0 To List1.ListCount - 1Dim v() As Stringv = Split(List1.List(i), ":", 2)1.Text = v(0)2.Text = v(1)Call Command2_ClickPause2Next iEnd Sub
Pause Function
Hi all, if I execute huge number of loops within a function, can I make use of timer and command button to stop the execuation temporarily and then start again? If yes, could you give me some hints?
How To Pause A Function?
I have a function that executes until it runs into an inconsistency, then another form loads to supply the correct variable. The problem I am running into is that although the other form loads the primary form where the function is running continues to run. How can I pause the current function until the value is supplied from the form it calls?
Thanks
Pause A Function
I used to have a bas file that would allow you to "Pause" a sub for a give ammount of time.
It was something like
Code:Label1.caption = "Text"
Code:Pause (5)
Code:Label1.caption = "New Text"
That would pause for 5 seconds. Anyone know of a .bas like this or how I could accomplish the same thing. I know how to do it for a single event using a timer, I want something I can use a bunch throughout the program.
Thanks
Trouble With Pause Function
Ok, I've solved my problem and am using the windows media control to play my mp3 files. Here's my problem: I've got all of my buttons working just fine except for the pause function. This code works:
mediaplayer1.pause
The problem I'm having is resuming the file. Here's the code I have:
Private Sub Image25_Click()
If Paused = "paused" Then
Let Paused = ""
Mediaplayer1.resume
Else
'start playing
Mediaplayer1.FileName = "c:my musicmodern rockBlink182- The Rock Show.mp3"
Mediaplayer1.AutoStart = True
End If
End Sub
And here's my code for the Pause button:
Private Sub Image26_Click()
Let Paused = "paused"
Mediaplayer1.Pause
End Sub
Resume is not a function, so how can I go about telling the play button to resume where the file was paused?
Pause Function? [SOLVED]
Hi all im working on my weakest riddler game and wondered if there is any way to pause my code whilst it speaks then carry on after the speech had ended?
Cheers Lee
Edited by - Themodem on 4/27/2004 4:53:58 AM
Pause, Wait, Or Sleep Function?
Does anyone know of a function that works in VB for apps (Excel) that provides a simple one-line way to wait for a couple of seconds? The only one I can find is the application.wait method which is awkward because it uses absolute time instead of just like wait 2 seconds.
Small Problem With A 'Pause' Function.
I need to use a 'Sleep' type function in my program, but i cant use sleep because it literally freezes the entire application even with the "doevents" command added. I searched around the forum and i found a slice of code that someone posted on a similar topic.
Private Sub Pause(duration#)
Dim startTime#
startTime = Timer
Do While Timer - startTime < duration
DoEvents
Loop
End Sub
Everything works fine, except for ONE thing... When i'm moving the form across the screen while this code is being executed, it stops processing the code. In other words, if i run this code:
do until x = 10
form1.print x
Pause(1)
x = x + 1
loop
it will stop printing on the form when im moving the form across the screen. It will continue the code when i take my mouse off of it. So, is there anything i can do to prevent this?? Any help would be greatly appreciated.
Proxy Checker Pause Function
hi ive made a proxy checker and i was wondering if anyone had a code i could use to "pause" the checking and also one to stop it
meant to say this is the "start" function
VB Code:
Private Sub Command4_Click()List1.ListIndex = 0Call ScanEnd Sub
VB Code:
Sub Scan()Status.Caption = "Working"On Error Resume NextDim i As IntegerFor i = 0 To List1.ListCount - 1Unload Test(i)Load Test(i)proxy(i) = Split(List1.list(i), ":", , vbTextCompare)(0)port(i) = Split(List1.list(i), ":", , vbTextCompare)(1)NextItem List1Test(i).Connect proxy(i), port(i)Call Pause(Text1)Next iStatus.Caption = "Finished Wait A Few Minutes For Program To Catch Up With Scanning"End Sub
its just a simple stop and pause (task) function for command buttons i need if anyone can help
Need A Pause Type Function - Updated
Ok, i will try to explain this to my best ability.
it waits until a specified time, while it's doing this, it does something else every 10 seconds or so, all of this while the rest of the application is running.
Thank you SO VERY MUCH!
Trying To Create A Generic Timer/pause Function
hi all,
i am playing around with an idea to create a timeer/pause function for later use. for now all i am trying to do is get my label to flash from visible to not visible. the idea is to have a function/subroutine that allows me to run commands, pause then run the command again. in my posted code, i have it sort of working, unfortunatly it doesnt seem to be working at a regular interval. i tried using the debugger but that gave me weird results, sometimes the pause would loop a lot, then only once. i dont know where i am going wrong.
Code:
Private Sub pause(intDelayTime As Integer)
Dim lngNow As Long
Dim lngDest As Long
lngNow = timer
lngDest = lngNow + intDelayTime
Do While lngDest > lngNow
lngNow = timer
Loop
'pause = intDelay
End Sub
Private Sub cmdGo_Click()
Dim intWhile As Integer
intWhile = 0
Do While intWhile < 10
DoEvents
'actions go here
Call flash
pause (4) 'pause
Call flash
intWhile = intWhile + 1
pause (4)
Loop
End Sub
Private Sub flash()
If lblFlash.Visible = True Then
lblFlash.Visible = False
Else
lblFlash.Visible = True
End If
End Sub
any advice would be appreciated. msdn only suggests i use the timer function, but i have tried that and just cant get that to work at all.
Pause Untill Private Function Finishes?
i have this code on a loop:
Call finddata
then it loads another private function which scans though a text file to find some data.
but as soon as it calls the finddata, it moves onto the next command, i need it to pause and wait untill that function has finished.
Play, Stop, Pause, Loop Play MP-3
respected codeguru users and viewers,
how i can play mp3 file in my program i used mmcontrol and active movie control but not the solution due to lack of experience, can any one help me how its done, thanx for viewing and responsing,
The Point Function
I think the Point function is supposed to return a RGB value in long form but I can't figure out how to interpret it. Can someone tell me what it means? I thought an RGB was supposed to be something like 0-255, 0-255, 0-255, but for black (I think I got 8388608 all in one blob. I'm confused...
Point Function
I want to use the POINT function on an internet browser. Do i have to download a special .ocx file or is there an easier way of doing the equivalent, basically a functon which returns the colour of each individual pixel of an internet site.
Thanks .
Point Function
Hi All,
Point function of Form object returns color of the pixel at a
partcular location on the form.
I tried to use this function in a project of Graphics.
I found that the behaviour of the function was strange.
Sometimes, the function returned a color value upon clicking
a pixel on form.
Other times, it simply falied to return anything.
It just kept returning -1 eventhought the color of the pixel was red.
The same code worked on other PCs while on still others it failed.
Can anyone explain why Point function behaves like this ?
I need a quick reply.
Thank you.
.Point Function In Direct X?
Due to certain reasons, I am switching my game over from regular bitblt to Direct X 7. When I was using bitblt, I checked the color of a certain pixel in a picture that was on the fom using the picture.point(x,y) command. Is there a simlar command that I can use in Direct X that I can check the color of a pixel in a Direct Draw Surface?
Function To Cut The Floating Point Value
Hi, I am looking for the function that cuts the point in numbers.
EXAMPLE:
a = func("5.7")
a becomes 5
See what I mean, just want to cut the point in a real/floating point value.
I tried using an Integer but that just rounds it up (I do not want to do this)
3.9 becomes 4 (<-- NOT RIGHT)
3.9 becomes 3 (<-- RIGHT)
Thanks
The Break Point Function
I have a question regarding this.
What does the code window break point function do and how does it work?
-thanks-
What Is The Point Of The Call Function?
Hi,
I keep seeing people use the Call function and i don't understand why .
Personally i would just put the sub/functions name to activate it, so What is the point of the Call function?
--------------------------------------------------
Should I apologize if what I say burns your
ears and stains your eyes?!
Function To Find And Angle Of A Point?
I am trying to draw arcs, what I have is the center point of the arc as well as starting point and end point. For vb I need the radius, which is pretty easy to calculate, but I need to find out the start and end angle of the arc from the start and end points given to me. I guess easiest way would be to move the center of the circle to (0, 0) and then use inverse tan to find the angles which could be converted to radians.
What is the easiest way to obtain the angle of the points in this case.
A Function To Point To Specific Form
I have 3 forms, frmMain, frmStatus, frmWhatever
When I
Code:
PointForm(2).Show
, it show up frmStatus, because there's a function like this:
Code:
Private Function PointForm(Item As Integer) As Form
Select Case Item
Case 1: PointForm = frmMain
Case 2: PointForm = frmStatus
Case 3: PointForm = frmWhatever
End Select
End Function
The function above obviously doesn't work, but it's something i wanna do, a function that tells which form. Erm. is that possible?
Point In Region Function...what Is Wrong With My Code
whats wrong with this code, i am trying to use the point in region function
except the value keeps coming up as 0 even when i have the point inside my region.
heres the code below(note a few lines are spread out onto a second line)
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If PtInRegion(hRgn, X, Y) = 0 Then Me.Caption = "out" Else Me.Caption = "in"
End Sub
Private Sub Form_Paint()
Me.ScaleMode = 3
hBrush = CreateSolidBrush(vbRed)
hOldBrush = SelectObject(Me.hdc, hBrush)
NumCoords = 3
Me.ScaleMode = vbPixels
poly(1).X = 0
poly(1).Y = 0
poly(2).X = 200
poly(2).Y = 100
poly(3).X = 150
poly(3).Y = 200
Polygon Me.hdc, poly(1), NumCoords
hRgn = CreatePolygonRgn(poly(1), NumCoords, ALTERNATE)
If hRgn Then FillRgn Me.hdc, hRgn, hBrush
'DeleteObject hRgn
'DeleteObject hBrush
End Sub
How To Draw Point And Line(any Built-in Function?)
Dear All,
On a form, I have an Image control. I have loaded the picture in this Image control.
I have to draw some points on this and then join these points so that a line is drawn( means to draw a line that passes through these points.)
How can I draw a point and line. What's the built-in function for these.
Please guide and help.
Regards,
What Would Stop A Public Function Being Seen?
I have a form (frmA) that has a public function in it, which is declared like this:
Public Function Init() As Boolean
In the code of another form (frmB) when I type frmA. VB isn't showing me a list of public functions declared in frmA. I've inherited frmA from someone else. Is there some option or other in VB that is stopping frmB from seeing the Init function in frmA? I've not had this problem before, I can refer to other public functions in other forms without problems.
Stop ReadFile Function !!
Hi,
I use ReadFile API function to read a file from a CD, the file have a bad or damaged end, so when the function reach the bad part of the file it took and hang the system for more than 45sec and then it return the "Read Error .. " message .
I even use a way that read Byte by byte but the delay occurs at the first single damaged byte and caused all the system to be hang for 45sec ..
What I need is : a way that return the "read error .." message faster as possible .. and save time by stop trying to read the bad or damaged part .
I appreciate any HELP
Thanks
VB && Excel - How To Stop A Function
I have the following problem. Suppose I added a button to my worksheet
and when user clicks the button a function starts. Now, as long as
this function is running the worksheet is not active. The question is:
is it possible to stop this function from the worksheet, for example
is it possible to add another button to the worksheet so that the user
could click this button and stop the function that is running after he
clicked the first button?
rgds.
Jakub
[HELP] Button To Stop Executiong Function??
i have a program that search inide txt files for a certain string
what i want is to create a button to stop the searching.. like the abort button you have in the standard windows search
any help?
thanks
Function Won't Stop... Even After It's Form Is Unloaded!
Alright... wierd deal.
I have a public function on a form (a download progress form) that I call from another form. Now statements execute normally in that function... but if I click the close box the form unloads (I set the form = Nothing in the Form_Unload event) the statements still execute!
Windows calls an IBindStatusCallback_OnProgress event repeatedly in my program. This might be why the statements in that function keep going even after I have unloaded it!
What can I do to stop the rest of the statements in that function from executing after the form has been unloaded?
|