Results 1 to 7 of 7

Thread: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Resolved [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    Here is the code i am using for put a resource(music) to a file.

    Code:
    Public Sub ResToFile(FileName As String, ResID As Variant, ResType As Variant, Optional overwrite As Boolean = True)
        Dim Buffer() As Byte
        Dim Filenum As Integer
    
    If Dir(FileName) <> Empty Then 'Check if output file already exists
      If overwrite Then Kill FileName Else Err.Raise 58
    End If
    
        Buffer = LoadResData(ResID, ResType) 'Load the resource into a byte array
        Filenum = FreeFile
    
    Open FileName For Binary Access Write As Filenum
        Put Filenum, , Buffer 'Write the entire array into the file
    Close Filenum
    
    End Sub
    I have run it like 4 times, and it has worked before. Idk why its saying this now. It highlighted the text above that is in blue, and i checked the path and there was a file there.... Why is it giving me this error, and how can i fix it?


    EDIT: XD I got it. Added Kill then the only file that was giving me that problem. =P
    Last edited by Gamemaster1494; May 29th, 2010 at 05:47 PM. Reason: fixed it
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    You should note that Kill will not be able to delete a file if it has the read only or hidden attributes set, and if the file is protected (Vista/W7) that will require admin rights to delete. Maybe you should error-check to see if delete was successful.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    What about it being an archive? because i have XP OS.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    I think it can delete the archive fine. But in any case, you can use the SetAttr function to set it to vbNormal which will remove other attributes so it can be deleted.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    ...How would you do that?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    Like I said, SetAttr. It's an internal VB function, just set the file you want to delete to vbNormal with it, then do a Kill.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: [RESOLVED] Run Time Error 70, premission denied with ResToFile? Why is this!?

    oh. okay . thanks.
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width