The cod i am using to load pictures into memory is not
fully working.
Its seem spuratic.... loading some ..sometimes.. then others..other times.
Heres the code
Im module mBitmap
VB Code:
Function LoadBitmap(iFileName As String) As Long Dim A As Long If Dir(iFileName) = "" Then 'Error: File not found LoadBitmap = -1 Exit Function End If 'Check if already loaded For A = 0 To BitmapCount If Bitmap(A).FileName = LCase(iFileName) Then 'Bitmap already loaded LoadBitmap = A Exit Function End If Next 'Allocate memory BitmapCount = BitmapCount + 1 ReDim Preserve Bitmap(BitmapCount) 'Load file LoadDC iFileName, Bitmap(BitmapCount) 'Return index If Bitmap(BitmapCount).DC > -1 Then LoadBitmap = BitmapCount Else LoadBitmap = -1 End If End Function Function LoadDC(iFileName As String, iBitmap As tBitmap) As Long Dim DC As Long Dim Temp As IPictureDisp 'Create compatible DC DC = CreateCompatibleDC(MainWindow.hdc) If DC < 1 Then 'Error: Can't create compatible DC LoadDC = -1 Exit Function End If 'Load bitmap Set Temp = LoadPicture(iFileName) SelectObject DC, Temp 'Apply values With iBitmap .FileName = LCase(iFileName) .DC = DC LoadDC = DC .W = MainWindow.ScaleX(Temp.Width) .H = MainWindow.ScaleY(Temp.Height) End With 'Release memory DeleteObject Temp Set Temp = Nothing End Function
in form
Any suggestions why this does not werk?VB Code:
mBitmap.Initialize Me For A = 0 To 8 mBitmap.LoadBitmap App.Path & "\" & A & ".jpg" Next Dim i As Integer For i = 0 To UBound(Bitmap) List1.AddItem Bitmap(i).FileName Next
Screen shot![]()




Reply With Quote