|
-
May 21st, 2007, 04:32 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Help needed! DoEvents doesnt works
Hi.
My app executes a function that takes a lot of time.
Therefor, I created a form with a little animation made with 12 icons placed in a imagelist.
Right before the execution of that function, I load that form.
The form has a timer, so each 1/2 second it changes the image in the form icon and the image of image" object.
Code:
Private Sub Timer1_Timer()
Me.SetFocus
DoEvents
Me.Refresh
Me.Image1.Refresh
i = i + 1
Me.Image1 = Me.ImageList1.ListImages(i).Picture
Me.Icon = Me.ImageList1.ListImages(i).Picture
If i = 12 Then i = 1
End Sub
What happens is that I cant see the animation "running".
In the mainForm I have this code:
Code:
'...
FormWait.Show
FormWait.SetFocus
DoEvents
verify = Generate.PS2(file)
Unload FormWait
'...
Thanks
Last edited by RS_Arm; May 21st, 2007 at 04:50 AM.
-
May 21st, 2007, 05:09 AM
#2
Addicted Member
Re: Help needed! DoEvents doesnt works
How is 'i' defined? If it's not defined at all 'i' will never get to a value higher than 1.
If a post has been helpful, Rate it!
-
May 21st, 2007, 05:29 AM
#3
Re: Help needed! DoEvents doesnt works
Also...If your code runs a loop, place the doevent inside that loop (inside Generate.PS2 method).
vb Code:
Private Function YourCPUIntensiveFunction() As Long
Do While (SomeCondition)
DoEvents
' Do The Job
Loop
End Function
-
May 21st, 2007, 05:35 AM
#4
Thread Starter
Hyperactive Member
Re: Help needed! DoEvents doesnt works
Well, i is defined as integer.
If I run the ForWait as StandAlone, the animation works well.
To iPrank
My function is called by a dll.
Should I put DoEvents in the dll?
-
May 21st, 2007, 05:41 AM
#5
Re: Help needed! DoEvents doesnt works
I'm not sure about how DoEvents works on threads (or how the dll uses threading)...but if you have the source code give it a try.
-
May 21st, 2007, 05:48 AM
#6
Thread Starter
Hyperactive Member
Re: Help needed! DoEvents doesnt works
Ok, I've tryed to put DoEvents on the dll function and it worked.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|