P
Paul Perot
Hi All:
I need some help. I am using DSOFile.exe to examine and add and/or
manipulate some document and custom properties on a JPEG file. When the
document properties are correct, I would like to copy or move the modified
file to a new location. The problem that I am having is that the modified
file is somehow being held in memory and not being released. I use the
following code to read in the file:
Try
oFilePropReader = New DSOleFile.PropertyReader
oDocProp = oFilePropReader.GetDocumentProperties(txt_FileLoc.Text)
Try
If Not oDocProp.AppName.ToString Is Nothing Then
lstNormalProps.Items.Add("AppName: " & oDocProp.AppName.ToString)
Catch ex As Exception
Err.Clear()
End Try
.........
Catch ex As Exception
MsgBox(ex.Message & " Please choose another file.", Page)
Err.Clear()
End Try
This part all works fine... then to release the file from memory I use the
following code...
If Not oDocProp Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oDocProp)
oDocProp = Nothing
GC.Collect()
End If
If Not oFilePropReader Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oFilePropReader)
oFilePropReader = Nothing
GC.Collect()
End If
So far...so good.. the file is released from memory and I can move or copy
it with no problem... Where the problem exists is when I review the
CustomDocumentProperties...using the following code...
Try
oFilePropReader = New DSOleFile.PropertyReader
oDocProp = oFilePropReader.GetDocumentProperties(txt_FileLoc.Text)
Try
If Not oDocProp.AppName.ToString Is Nothing Then
lstNormalProps.Items.Add("AppName: " & oDocProp.AppName.ToString)
Catch ex As Exception
Err.Clear()
End Try
.........
For Each oCustProp In oDocProp.CustomProperties
sTmp = oCustProp.Name & ": " & CStr(oCustProp.Value)
lstNormalProps.Items.Add("Custom Property: " & sTmp)
Next
Catch ex As Exception
MsgBox(ex.Message & " Please choose another file.", Page)
Err.Clear()
End Try
Then nothing I have done seems to get the file to be released... Does anyone
have any suggestions...or ideas ... or code snippets??? Thank you for your
timely advice.
--
Best regards
Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)
I need some help. I am using DSOFile.exe to examine and add and/or
manipulate some document and custom properties on a JPEG file. When the
document properties are correct, I would like to copy or move the modified
file to a new location. The problem that I am having is that the modified
file is somehow being held in memory and not being released. I use the
following code to read in the file:
Try
oFilePropReader = New DSOleFile.PropertyReader
oDocProp = oFilePropReader.GetDocumentProperties(txt_FileLoc.Text)
Try
If Not oDocProp.AppName.ToString Is Nothing Then
lstNormalProps.Items.Add("AppName: " & oDocProp.AppName.ToString)
Catch ex As Exception
Err.Clear()
End Try
.........
Catch ex As Exception
MsgBox(ex.Message & " Please choose another file.", Page)
Err.Clear()
End Try
This part all works fine... then to release the file from memory I use the
following code...
If Not oDocProp Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oDocProp)
oDocProp = Nothing
GC.Collect()
End If
If Not oFilePropReader Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(oFilePropReader)
oFilePropReader = Nothing
GC.Collect()
End If
So far...so good.. the file is released from memory and I can move or copy
it with no problem... Where the problem exists is when I review the
CustomDocumentProperties...using the following code...
Try
oFilePropReader = New DSOleFile.PropertyReader
oDocProp = oFilePropReader.GetDocumentProperties(txt_FileLoc.Text)
Try
If Not oDocProp.AppName.ToString Is Nothing Then
lstNormalProps.Items.Add("AppName: " & oDocProp.AppName.ToString)
Catch ex As Exception
Err.Clear()
End Try
.........
For Each oCustProp In oDocProp.CustomProperties
sTmp = oCustProp.Name & ": " & CStr(oCustProp.Value)
lstNormalProps.Items.Add("Custom Property: " & sTmp)
Next
Catch ex As Exception
MsgBox(ex.Message & " Please choose another file.", Page)
Err.Clear()
End Try
Then nothing I have done seems to get the file to be released... Does anyone
have any suggestions...or ideas ... or code snippets??? Thank you for your
timely advice.
--
Best regards
Paul Perot
President
Perot Solutions
(e-mail address removed)
(770) 565 - 9151
(678) 852 - 7789 (c)