Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1615

Re: Where To Write My File

From "DaveO" <djo@dial.pipex.com>
Newsgroups comp.lang.basic.visual.misc
Subject Re: Where To Write My File
Date 2012-11-05 09:54 +0000
Organization A noiseless patient Spider
Message-ID <k782d0$edd$1@dont-email.me> (permalink)
References <e%Als.206617$9W6.163405@fx08.am4>

Show all headers | View raw


"Ivar" <ivar.ekstromer000@ntlworld.com> wrote in message 
news:e%Als.206617$9W6.163405@fx08.am4...
> Hi All
>
> Been very quite here recently, hopefully a few VB6 gurus are still 
> monitoring?
>
> I have an app that writes compressed files to users chosen location.
> This compression was done internally by the app itself but it was a bit 
> slow.
> So I downloaded a dll file that does just as good a job but sooo much 
> faster.
> What I would like to be able to do is have this dll stored in the resource 
> file of the exe and create it as and when needed.

You can copy the file to a Resource file as a "Custom Resource" then use 
something like this to write it to disc:

Public Function ExtractFromResource(ResName As String, NewFileName As 
String, Optional bnSilent As Boolean = False) As Boolean
Dim fBuff()   As Byte
Dim ff        As Integer

fBuff = LoadResData(ResName, "CUSTOM")
ff = FreeFile
On Error GoTo ErrBadPath
Open NewFileName For Binary As #ff
Put #ff, , fBuff
Close #ff
On Error GoTo 0
ExtractFromResource = True
Exit Function

ErrBadPath:
If Not bnSilent Then MsgBox "Error writing to selected path, check your 
permissions", vbExclamation, "Write Error"
ExtractFromResource = False
End Function

However as Jim pointed out, depending upon where you try to write the file 
any anti-virus software is going to take objection to such behaviour.
(The above code is just a starting point, it need testing for existing file 
and again to ensure the file was actually written, although that could 
easily be in whatever calls this routine)

Regards
DaveO. 

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-04 21:21 +0000
  Re: Where To Write My File Jim Mack <no-uce-ube@mdxi.com> - 2012-11-04 16:51 -0500
  Re: Where To Write My File "DaveO" <djo@dial.pipex.com> - 2012-11-05 09:54 +0000
  Re: Where To Write My File Deanna Earley <dee.earley@icode.co.uk> - 2012-11-05 10:12 +0000
  Re: Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-05 11:35 +0000
    Re: Where To Write My File "DaveO" <djo@dial.pipex.com> - 2012-11-05 11:59 +0000
      Re: Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-05 12:17 +0000
        Re: Where To Write My File Deanna Earley <dee.earley@icode.co.uk> - 2012-11-05 13:43 +0000
  Re: Where To Write My File GS <gs@somewhere.net> - 2012-11-12 10:00 -0500
    Re: Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-12 19:10 +0000
      Re: Where To Write My File GS <gs@somewhere.net> - 2012-11-12 17:08 -0500
      Re: Where To Write My File "Thorsten Albers" <gudea@gmx.de> - 2012-11-12 23:29 +0000
        Re: Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-13 11:43 +0000
          Re: Where To Write My File Schmidt <sss@online.de> - 2012-11-13 14:43 +0100
            Re: Where To Write My File "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-11-13 17:07 +0000
              Re: Where To Write My File Schmidt <sss@online.de> - 2012-11-13 19:00 +0100
              Re: Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-13 19:10 +0000
          Re: Where To Write My File "Mayayana" <mayayana@invalid.nospam> - 2012-11-13 09:08 -0500
            Re: Where To Write My File "Ivar" <ivar.ekstromer000@ntlworld.com> - 2012-11-13 19:16 +0000
          Re: Where To Write My File ralph <nt_consulting64@yahoo.com> - 2012-11-13 09:18 -0600
            Re: Where To Write My File "DaveO" <djo@dial.pipex.com> - 2012-11-13 16:41 +0000
              Re: Where To Write My File "CoderX" <coder@x.com> - 2012-11-15 13:38 -0500
      Re: Where To Write My File Deanna Earley <dee.earley@icode.co.uk> - 2012-11-13 10:19 +0000

csiph-web