Not a Member Yet,
Click here to Register

ID: 472
Viewed: 3578
Added: Aug 19, 2002
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Storing / Retrieving Files from a Resource File

Highlight all by clicking in box

Highlight All

Public Function CreateFileFromResource(ByVal FilePath As String, _
ByVal ResID As Long, _
ByVal ResType As String) _
As Boolean

'This function returns False if LoadResData() fails (unlikely)
'It also does not check to see whether FilePath already exists
'or do much error checking of any kind for that matter :-)

Dm hFile As Long
Dim FileData() As Byte

FileData = LoadResData(ResID, ResType) 'this loads your binary data
On Error Resume Next 'stuck this here just so the prog won't
'crash if something goes wrong with LoadResData()

If Len(FileData(1)) > 0 Then
hFile = FreeFile()
Open FilePath For Binary Access Write As #hFile
Put #hFile, 1, FileData 'this writes your binary data
Close #hFile
CreateFileFromResource = True
End If

End Function

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!