Help: Progress Bar code generates Run Time Error 6 
Author Message
 Help: Progress Bar code generates Run Time Error 6

Hello all:

I copied this code from the VB KB and followed their instructions, but
alas, I'm getting a Runtime error code 6 on the line:
r = BitBlt(Picture1.hDC, 0, 0, Picture1.ScaleWidth....etc..
I'm running Windows NT and VB4 32bit.  Any suggestions?? Thanks in
advance!

PS: if you cut and paste from my post, make sure all the lines that are
supposed to be on one line appear so in your code.

Dim tenth As Long
#If Win32 Then
Private Declare Function BitBlt Lib "GDI32" (ByVal hDestDC As Integer,
ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal
nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer,
ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
#Else
Private Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer,
ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal
nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer,
ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
#End If
Sub UpdateStatus(FileBytes As Long)
'Update the Picture1 status bar
Static progress As Long
Const SRCCOPY = &HCC0020
Dim Txt$
progress = progress + FileBytes
If progress > Picture1.ScaleWidth Then
progress = Picture1.ScaleWidth
End If
Txt$ = Format$(CLng((progress / Picture1.ScaleWidth) * 100)) + "%"
Picture1.Cls
Picture1.CurrentX = (Picture1.ScaleWidth - Picture1.TextWidth(Txt$)) \ 2
Picture1.CurrentY = (Picture1.ScaleHeight - Picture1.TextHeight(Txt$)) \
2
Picture1.Print Txt$
Picture1.Line (0, 0)-(progress, Picture1.ScaleHeight),
Picture1.ForeColor, BF
r = BitBlt(Picture1.hDC, 0, 0, Picture1.ScaleWidth,
Picture1.ScaleHeight, Picture1.hDC, 0, 0, SRCCOPY)
End Sub

Private Sub Form_Load()
    Picture1.AutoRedraw = True
    Picture1.BackColor = &H80000003
    Picture1.DrawMode = 10
    Picture1.FillStyle = 0
    Picture1.ForeColor = &H80
End Sub

Private Sub Command1_Click()
    Picture1.ScaleWidth = 109
    tenth = 10
    For i = 1 To 10
        Call UpdateStatus(tenth)
            X = Timer
        While Timer < X + 0.75
            DoEvents
        Wend
    Next
End Sub

Ron



Sun, 25 Jul 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help:Howto run a progress bar using the size of a file as progressbar.max

2. Code running in design time or run-time?

3. Help needed with Progress Bars and Status Bars

4. HElp with progress bar on MDI status bar

5. HElp with progress bar on MDI status bar

6. Progress Bar In Status Bar....Help Please

7. Microsoft Visual C++ Run time library Run time error R6025

8. Microsoft Visual C++ Run time library Run time error R6025

9. How to use progress bar with time?

10. Using Progress Bar to track time while an event is being processed

11. Progress bar to track db update time

12. Creating progress bar for while CR is running

 

 
Powered by phpBB® Forum Software