| | |
STOP a process in between .....
![]() |
Hi, use
DoEvents function so that other process get chance. This function helps to disable your form.
Example
DoEvents function so that other process get chance. This function helps to disable your form.
Example
VB Syntax (Toggle Plain Text)
Dim bStop As Boolean Private Sub cmdProcess_Click() Do While bStop <> True ' ' Long Process ' CurrentX = 0 CurrentY = 0 Cls Print Time DoEvents Loop bStop = False End Sub Private Sub cmdStop_Click() bStop = True End Sub
KSG
•
•
•
•
Hi, use
DoEvents function so that other process get chance. This function helps to disable your form.
Example
VB Syntax (Toggle Plain Text)
Dim bStop As Boolean Private Sub cmdProcess_Click() Do While bStop <> True ' ' Long Process ' CurrentX = 0 CurrentY = 0 Cls Print Time DoEvents Loop bStop = False End Sub Private Sub cmdStop_Click() bStop = True End Sub
Sorry this did not work i told u that, mu Form1 gets disabled, thats normal when there's some long process is taking place. So im not getting access to the cmdButton (to click).
•
•
•
•
If it is a system call (such as shell, or wsh.run) and it is blocking (ie, the program is waiting for shell or wsh.run to finish the externally running program), you need a much more complicated method involving things like waitforsingleobject...
Im not running any other program or shell.
Its just that the Form1 is processing a long process. Like suppose counting to 1000crores or more.
Last edited by RahulV; Feb 16th, 2009 at 2:58 pm.
then doevents should work just fine.... somewhere when your form1 is doing processing... probably in some kind of do loop or while loop or for loop, simply stick a doevents.
vb Syntax (Toggle Plain Text)
for i = 0 to 1000000 retval = i * i doevents next i
Last edited by Comatose; Feb 16th, 2009 at 3:53 pm.
•
•
•
•
then doevents should work just fine.... somewhere when your form1 is doing processing... probably in some kind of do loop or while loop or for loop, simply stick a doevents.
vb Syntax (Toggle Plain Text)
for i = 0 to 1000000 retval = i * i doevents next i
Pls can anyone help me with this.
can creating thread help with this?
I'm going to need to see your code then, in order to be able to troubleshoot this further.
You can not create a thread in Visual Basic 4/5/6. Doevents is only a partial fix to your problem. Doevents tells VB that a long ass loop is going on, and that it needs to do other stuff too, like handle mouse clicks. So, just for example, make a form and put 2 buttons on it....in button1, put this:
Then, in button2, put this:
Now run the code, and click button1. Now Try to click button2. Nice Huh? Now modify button1 to have this:
Run the code, click button1, now click button2..... oh wow. Big difference.
You can not create a thread in Visual Basic 4/5/6. Doevents is only a partial fix to your problem. Doevents tells VB that a long ass loop is going on, and that it needs to do other stuff too, like handle mouse clicks. So, just for example, make a form and put 2 buttons on it....in button1, put this:
vb Syntax (Toggle Plain Text)
while 1 = 1 x = 200 * 200 wend
vb Syntax (Toggle Plain Text)
end
vb Syntax (Toggle Plain Text)
while 1 = 1 x = 200 * 200 doevents wend
Last edited by Comatose; Feb 18th, 2009 at 9:29 am.
@ Comatose
Okay!
that does work.
but in ur example u had written statement for Button2 and that ends the whole program, instead i want to just end the running sub-procedure or the loop.
You have any other idea on this?
Okay!
that does work.
but in ur example u had written
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
End
You have any other idea on this?
![]() |
Similar Threads
- stop a process using php (PHP)
- unclosable process firefox.exe or iexplore.exe (Viruses, Spyware and other Nasties)
- "System Idle Process" (Windows NT / 2000 / XP)
- wupdater.exe error message (Web Browsers)
- CPU is fully used up by a single process, HELP (Windows NT / 2000 / XP)
- CD burner stalling.. (Storage)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: SSTAB problem with TAB2
- Next Thread: access events of form in UserControl
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






