G
Graham Skan
Guest
Hi,
I am a displaced person from VB6. The program ran in VB6 until in failed after a recent Windows 10 update. The original code has now been converted using VB2008.
Now running in VB2019
The code appears to get the length of the file and then fail because the length is wrong.
Private Function OpenJPGFile(ByVal inFile As String) As Object
Dim fFile As Short
fFile = FreeFile
FileOpen(fFile, inFile, OpenMode.Binary)
ReDim ExifTemp(LOF(fFile) + 1)
'UPGRADE_WARNING: Get was upgraded to FileGet and has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
FileGet(fFile, ExifTemp)
FileClose(fFile)
End Function
System.ArgumentException
HResult=0x80070057
Message=Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
Source=Microsoft.VisualBasic
StackTrace:
at Microsoft.VisualBasic.FileSystem.FileGet(Int32 FileNumber, Array& Value, Int64 RecordNumber, Boolean ArrayIsDynamic, Boolean StringIsFixedLength)
at SavePhotos4Net.ExifReader.OpenJPGFile(String inFile) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\ExifReader.vb:line 260
at SavePhotos4Net.ExifReader.Load(String picFile) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\ExifReader.vb:line 233
at SavePhotos4Net.Form1.GetNewNameExif(String& strInFullName) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 508
at SavePhotos4Net.Form1.ProcessFilesInFolder(Folder& fol) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 424
at SavePhotos4Net.Form1.ProcessFilesInFolder(Folder& fol) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 458
at SavePhotos4Net.Form1.ProcessMainFolders() in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 391
at SavePhotos4Net.Form1.cmdProcessMedia_Click(Object eventSender, EventArgs eventArgs) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 154
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SavePhotos4Net.Form1.Main()
Continue reading...
I am a displaced person from VB6. The program ran in VB6 until in failed after a recent Windows 10 update. The original code has now been converted using VB2008.
Now running in VB2019
The code appears to get the length of the file and then fail because the length is wrong.
Private Function OpenJPGFile(ByVal inFile As String) As Object
Dim fFile As Short
fFile = FreeFile
FileOpen(fFile, inFile, OpenMode.Binary)
ReDim ExifTemp(LOF(fFile) + 1)
'UPGRADE_WARNING: Get was upgraded to FileGet and has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
FileGet(fFile, ExifTemp)
FileClose(fFile)
End Function
System.ArgumentException
HResult=0x80070057
Message=Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
Source=Microsoft.VisualBasic
StackTrace:
at Microsoft.VisualBasic.FileSystem.FileGet(Int32 FileNumber, Array& Value, Int64 RecordNumber, Boolean ArrayIsDynamic, Boolean StringIsFixedLength)
at SavePhotos4Net.ExifReader.OpenJPGFile(String inFile) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\ExifReader.vb:line 260
at SavePhotos4Net.ExifReader.Load(String picFile) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\ExifReader.vb:line 233
at SavePhotos4Net.Form1.GetNewNameExif(String& strInFullName) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 508
at SavePhotos4Net.Form1.ProcessFilesInFolder(Folder& fol) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 424
at SavePhotos4Net.Form1.ProcessFilesInFolder(Folder& fol) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 458
at SavePhotos4Net.Form1.ProcessMainFolders() in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 391
at SavePhotos4Net.Form1.cmdProcessMedia_Click(Object eventSender, EventArgs eventArgs) in J:\Allwork\Visual Studio 2019\SavePhotosADO.NET\Backup\Form1.vb:line 154
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SavePhotos4Net.Form1.Main()
Continue reading...