Hi,
ich weis nicht woran es liegt, aber nachfolgender Code erzeugt eine OutOfMemoryException sobald das erste Bild kopiert wurde:
Kann mir jemand sagen was da falsch ist?
ich weis nicht woran es liegt, aber nachfolgender Code erzeugt eine OutOfMemoryException sobald das erste Bild kopiert wurde:
VB.NET-Quellcode
- Imports System.IO
- Imports System.Environment
- Public Class frmMain
- Private Destination As String = GetFolderPath(SpecialFolder.MyPictures) & "\winSpotlight\"
- Private Source() As FileInfo = New DirectoryInfo(GetFolderPath(SpecialFolder.LocalApplicationData) & "\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets").GetFiles
- Private bmpCounter As Integer = 0
- Private Sub btnCopyImage_Click(sender As Object, e As EventArgs) Handles btnCopyImage.Click
- For Each f As FileInfo In Source
- Using bmp = New Bitmap(Bitmap.FromFile(f.FullName))
- If bmp.Width < 1900 Then
- bmp.Dispose()
- Continue For
- End If
- bmp.Save(Destination & "Wallpaper" & bmpCounter & ".bmp")
- bmpCounter += 1
- End Using
- Next
- End Sub
- End Class
Kann mir jemand sagen was da falsch ist?
"Hier könnte Ihre Werbung stehen..."