473,805 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ZIP code module without DLL dependencies???

Hi Everyone,

I am trying to find a solution for handling zipped data without the
need to ship / install any DLL files with the database. Does anybody
know of code to handle ZIP files that does not require any external
references? If I can ship it 'built-in' as either a class module or
standard module then that would be perfect.

Any help would be greatly appreciated.

Cheers

The Frog
Nov 19 '07
36 3119
"Stuart McCall" <sm*****@myunre albox.comwrote:
BTW that might not even work on my system. I did the following to disable the
Windows zipping and am using (a legally purchased) Winzip.

Irritating searching within zip files
regsvr32 /u zipfldr.dll

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Nov 22 '07 #11
The Frog <Mr************ @googlemail.com wrote:
>My goodness, we seem to have stirred up a lot of interest here.
<smile Sure, we were getting bored.
>With regards to using external dll's such as the infofzip ones, has
anyone got an opinion to offer about their use? I was thinking that I
would make a hidden table and store the dll as a blob, pop the dll
into a temporary location when needed, then destroy it again at the
end of the process. Has anyone done this before or have any other
recommendation s? (Installing stuff is actually quite hard in this
corporate environment, so minimising dependencies is crucial -
effectively I need to be able to ship just an MDB / MDE file and let
it do its job without concern for what is / isnt on the system in
question).
Hmm, yes, that's possible I do beleive. Check Stephen Lebans website. Hmm, here's
one but it doesn't explicitly state dlls. http://www.lebans.com/oletodisk.htm That
said it does mention PDF files and such so it's quite possible. Worth spending a
half hour playing with it.

That's something I'm not too worried about as I don't mind packing up a few extra
DLLs for use. But I can see where you are coming from when dealing with IT Nazi
admins.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Nov 22 '07 #12
Hi Tony,

The admins here largely are the root cause of my programming problems.
They make unpredictable changes to the OS's on every machine, dont
tell anyone anything, and refuse to take any accountability for their
actions - in short they dont manage all that well and arent made to.

The result is that I have lost many months worth of work due to their
actions (I think something like ~60k lines of code this year so far)
because I cannot guarantee that the application will actually be able
to run on any given day. Some days they work fine and others they
simply wont at all. No way to predict it unfortunately.

Because of this I have set about collecting / creating modules for MS
Access (97) that remove the dependencies from the system itself and
therefore minimise the risk of the application not running. I still
have to keep a copy of MDAC installers on standby, but thats about it.
Right now I am grappling with ZIP so that I can get some output into a
small enough filesize to email to a large group. The alternative would
be to use online drop-boxes such as rapidshare - but as I see it these
represent a risk that potentially sensitive data can end up easily in
the wrong hands (and besides, it probably breaches the rules I have to
stick to).

I will have a play with the DLL option and storing it in the app
itself, and dragging it out when necessary. I will keep you posted
with the progress. Probably wont have the time till next week though
to post any code on this one.

Cheers and thanks for your help

The Frog
Nov 22 '07 #13
"The Frog" <Mr************ @googlemail.com wrote in message
news:0c******** *************** ***********@g21 g2000hsh.google groups.com...
Hi Tony,
<SNIP>
I will have a play with the DLL option and storing it in the app
itself, and dragging it out when necessary. I will keep you posted
with the progress. Probably wont have the time till next week though
to post any code on this one.

Cheers and thanks for your help

The Frog
You can try this module if you like. I've been using it successfully for
years, to "create" DLL's, icons, pictures and gen. purpose binary data. The
two main routines are FileToBinaryDat a and BinaryDataToFil e. The module as
it stands is intended to live in a library mdb. If you wish to use it in a
FE, simply change all CodeDB references to CurrentDb.

It requires a table tblBinaryData, with the structure:

Item Text 50
Value OLE Object

Item is the primary key.

''' CODE START '''
Option Compare Database
'
Private Const TPL_SELECT = "Select Value From tblBinaryData Where Item='?'"

Public Function GetBinaryData(B yVal Item$) As String
'Returns a binary item from tblBinaryData as a string

On Error GoTo GetBinaryData_E rr
'
With CodeDb.OpenReco rdset(Replace(T PL_SELECT, "?", Item),
dbOpenSnapshot)
GetBinaryData = !Value
.Close
End With

GetBinaryData_E xit:
Exit Function

GetBinaryData_E rr:
Resume GetBinaryData_E xit

End Function

Public Function PutBinaryData(B yVal Item$, ByVal Value$) As Boolean
'Stores a binary item in tblBinaryData
'Returns True for success

On Error GoTo PutBinaryData_E rr
'
With CodeDb.OpenReco rdset("tblBinar yData", dbOpenDynaset)
.FindFirst "Item=" & Quoted(Item)
If .NoMatch Then
.AddNew
!Item = Item
Else
.Edit
End If
!Value = Value
.Update
.Close
End With
'
PutBinaryData = True

PutBinaryData_E xit:
Exit Function

PutBinaryData_E rr:
Resume PutBinaryData_E xit

End Function

Public Function DelBinaryData(B yVal Item$) As Boolean
'Deletes a binary item from tblBinaryData
'Returns True for success

On Error GoTo DelBinaryData_E rr
'
With CodeDb.OpenReco rdset(Replace(T PL_SELECT, "?", Item), dbOpenDynaset)
If .BOF Then Exit Function
.Delete
.Close
End With
'
DelBinaryData = True

DelBinaryData_E xit:
Exit Function

DelBinaryData_E rr:
Resume DelBinaryData_E xit

End Function

Public Function FileToBinaryDat a(ByVal File$, ByVal Item$) As Boolean
'Retrieves a binary item from a file and stores it in tblBinaryData
'Returns True for success

On Error GoTo FileToBinaryDat a_Err
'
b$ = BinFileToString (File)
If b = "" Then Exit Function
FileToBinaryDat a = PutBinaryData(I tem, b)

FileToBinaryDat a_Exit:
Exit Function

FileToBinaryDat a_Err:
Resume FileToBinaryDat a_Exit

End Function

Public Function BinaryDataToFil e(ByVal File$, ByVal Item$) As Boolean
'Retrieves a binary item from tblBinaryData and creates a file from it
'Returns True for success

On Error GoTo BinaryDataToFil e_Err
'
b$ = GetBinaryData(I tem)
If b = "" Then Exit Function
StringToBinFile b, File
'
BinaryDataToFil e = True

BinaryDataToFil e_Exit:
Exit Function

BinaryDataToFil e_Err:
Resume BinaryDataToFil e_Exit

End Function

Public Function BinFileToString (ByVal File) As String
'Returns a binary item retrieved from a file

On Error GoTo BinFileToString _Err
'
f% = FreeFile
Open File For Binary Access Read Lock Write As f%
b$ = Space$(LOF(f))
Get #f%, , b
Close f
'
BinFileToString = b

BinFileToString _Exit:
Exit Function

BinFileToString _Err:
MsgBox Err.Description , vbCritical, "modBinaryData. BinFileToString "
Resume BinFileToString _Exit

End Function

Public Function StringToBinFile (ByVal bin$, ByVal File$) As Boolean
'Creates a file from the passed string
'Returns True for success

On Error GoTo StringToBinFile _Err
'
If Dir(File) <"" Then Kill File
f% = FreeFile
Open File For Binary Access Write Lock Read As f
Put #f, , bin
Close f
'
StringToBinFile = True

StringToBinFile _Exit:
Exit Function

StringToBinFile _Err:
MsgBox Err.Description , vbCritical, "modBinaryData. StringToBinFile "
Resume StringToBinFile _Exit

End Function
''' CODE END '''

Nov 22 '07 #14
"The Frog" <Mr************ @googlemail.com wrote in message
news:49******** *************** ***********@j20 g2000hsi.google groups.com...
Hi Everyone,
<SNIP>
Thankyou all for the valuable input on this too. The scripting stuff
is actually quite intriguing. I would be interested to see the single
file version if anyone has an idea on that one.
Take a look here:

http://www.rondebruin.nl/windowsxpzip.htm#Code

Examples for just about everything.

Nov 22 '07 #15
Hi Stuart,
personally, I would get rid of the string functions in your code. You are
working with binary data, not strings per se. Simply redim an array of Bytes
and use the VBA Get and Put methods to read/write the data. No string
conversions required, uses less resources and you will find the read/write
operations much faster.

Just my $.02

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Stuart McCall" <sm*****@myunre albox.comwrote in message
news:fi******** ***********@new s.demon.co.uk.. .
"The Frog" <Mr************ @googlemail.com wrote in message
news:0c******** *************** ***********@g21 g2000hsh.google groups.com...
>Hi Tony,
<SNIP>
>I will have a play with the DLL option and storing it in the app
itself, and dragging it out when necessary. I will keep you posted
with the progress. Probably wont have the time till next week though
to post any code on this one.

Cheers and thanks for your help

The Frog

You can try this module if you like. I've been using it successfully for
years, to "create" DLL's, icons, pictures and gen. purpose binary data.
The two main routines are FileToBinaryDat a and BinaryDataToFil e. The
module as it stands is intended to live in a library mdb. If you wish to
use it in a FE, simply change all CodeDB references to CurrentDb.

It requires a table tblBinaryData, with the structure:

Item Text 50
Value OLE Object

Item is the primary key.

''' CODE START '''
Option Compare Database
'
Private Const TPL_SELECT = "Select Value From tblBinaryData Where
Item='?'"

Public Function GetBinaryData(B yVal Item$) As String
'Returns a binary item from tblBinaryData as a string

On Error GoTo GetBinaryData_E rr
'
With CodeDb.OpenReco rdset(Replace(T PL_SELECT, "?", Item),
dbOpenSnapshot)
GetBinaryData = !Value
.Close
End With

GetBinaryData_E xit:
Exit Function

GetBinaryData_E rr:
Resume GetBinaryData_E xit

End Function

Public Function PutBinaryData(B yVal Item$, ByVal Value$) As Boolean
'Stores a binary item in tblBinaryData
'Returns True for success

On Error GoTo PutBinaryData_E rr
'
With CodeDb.OpenReco rdset("tblBinar yData", dbOpenDynaset)
.FindFirst "Item=" & Quoted(Item)
If .NoMatch Then
.AddNew
!Item = Item
Else
.Edit
End If
!Value = Value
.Update
.Close
End With
'
PutBinaryData = True

PutBinaryData_E xit:
Exit Function

PutBinaryData_E rr:
Resume PutBinaryData_E xit

End Function

Public Function DelBinaryData(B yVal Item$) As Boolean
'Deletes a binary item from tblBinaryData
'Returns True for success

On Error GoTo DelBinaryData_E rr
'
With CodeDb.OpenReco rdset(Replace(T PL_SELECT, "?", Item),
dbOpenDynaset)
If .BOF Then Exit Function
.Delete
.Close
End With
'
DelBinaryData = True

DelBinaryData_E xit:
Exit Function

DelBinaryData_E rr:
Resume DelBinaryData_E xit

End Function

Public Function FileToBinaryDat a(ByVal File$, ByVal Item$) As Boolean
'Retrieves a binary item from a file and stores it in tblBinaryData
'Returns True for success

On Error GoTo FileToBinaryDat a_Err
'
b$ = BinFileToString (File)
If b = "" Then Exit Function
FileToBinaryDat a = PutBinaryData(I tem, b)

FileToBinaryDat a_Exit:
Exit Function

FileToBinaryDat a_Err:
Resume FileToBinaryDat a_Exit

End Function

Public Function BinaryDataToFil e(ByVal File$, ByVal Item$) As Boolean
'Retrieves a binary item from tblBinaryData and creates a file from it
'Returns True for success

On Error GoTo BinaryDataToFil e_Err
'
b$ = GetBinaryData(I tem)
If b = "" Then Exit Function
StringToBinFile b, File
'
BinaryDataToFil e = True

BinaryDataToFil e_Exit:
Exit Function

BinaryDataToFil e_Err:
Resume BinaryDataToFil e_Exit

End Function

Public Function BinFileToString (ByVal File) As String
'Returns a binary item retrieved from a file

On Error GoTo BinFileToString _Err
'
f% = FreeFile
Open File For Binary Access Read Lock Write As f%
b$ = Space$(LOF(f))
Get #f%, , b
Close f
'
BinFileToString = b

BinFileToString _Exit:
Exit Function

BinFileToString _Err:
MsgBox Err.Description , vbCritical, "modBinaryData. BinFileToString "
Resume BinFileToString _Exit

End Function

Public Function StringToBinFile (ByVal bin$, ByVal File$) As Boolean
'Creates a file from the passed string
'Returns True for success

On Error GoTo StringToBinFile _Err
'
If Dir(File) <"" Then Kill File
f% = FreeFile
Open File For Binary Access Write Lock Read As f
Put #f, , bin
Close f
'
StringToBinFile = True

StringToBinFile _Exit:
Exit Function

StringToBinFile _Err:
MsgBox Err.Description , vbCritical, "modBinaryData. StringToBinFile "
Resume StringToBinFile _Exit

End Function
''' CODE END '''

Nov 23 '07 #16

"Stephen Lebans" <ForEmailGotoMy .WebSite.-WWWdotlebansdot ...@linvalid.co m>
wrote in message news:47******** **************@ news.aliant.net ...
Hi Stuart,
personally, I would get rid of the string functions in your code. You are
working with binary data, not strings per se. Simply redim an array of
Bytes and use the VBA Get and Put methods to read/write the data. No
string conversions required, uses less resources and you will find the
read/write operations much faster.

Just my $.02
<SNIP>

I appreciate the comment, but I think you need to look again. I'm not doing
any conversions, simply using a string as a buffer, and I'm using Get/Put to
read/write. However I take your point re the speed of read/write ops. I'll
run a few tests.

One thing I have been meaning to do is remove the ByVal's from the param
declares (can't remember why I did that, but then I did write this in Access
2.0). Just not got round to it yet.

Thanks, not least for making me look over it again. I just spotted that I'm
using a function from another module in the library (Quoted - surrounds data
with Chr(34)'s). I'll correct this for The Frog's benefit.

Nov 23 '07 #17
I just realised that there's a small function missing. Just add this to the
module:

Public Function Quoted(StringTo Quote As String) As String
If Left(StringToQu ote, 1) <Chr(34) Then
StringToQuote = Chr(34) & StringToQuote & Chr(34)
End If
Quoted = StringToQuote
End Function

Nov 23 '07 #18
On Thu, 22 Nov 2007 00:26:52 -0000, "Stuart McCall"
<sm*****@myunre albox.comwrote:
>"Tony Toews [MVP]" <tt****@teluspl anet.netwrote in message
news:nd******* *************** **********@4ax. com...
>"Stuart McCall" <sm*****@myunre albox.comwrote:

So I think I'll use the infozip dlls so long as they will work if copied
into the
same folder as the FE MDE. I do not want to worry about them having to be
installed
in the system32 folder.
>Yes, I have a developer's licence for BsZip (Big Speed Zip) which I've had
for years. I'll not be giving that up in a hurry. I'm just intrigued with
the way this method works.
There's also the (Free and Open Source) 7-Zip: http://www.7-zip.org/

which has a built-in command line interface. It's also "portable",
meaning it can run from a USB key without installing anything.

Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!
Nov 23 '07 #19
On Wed, 21 Nov 2007 10:01:25 -0000, "Stuart McCall"
<sm*****@myunre albox.comwrote:
>Although I've yet to find a way to copy individual files into the zip, other
than creating a folder, copying the files into it, then specifying this as
the source folder for the copy (which could be done transparently, but it's
a bit kludgy).
To copy a individual file into the zip file via VBS, you just do:

FileToZip = "C:\Data Files\My Data\MyFile.mdb "
set oApp = CreateObject("s hell.applicatio n")
oApp.namespace( ZipFileName).Co pyHere FileToZip

rather then the

'Copy the files to the compressed folder
Set oApp = CreateObject("S hell.Applicatio n")
oApp.NameSpace( ZipFileName).Co pyHere _
oApp.NameSpace( FolderToZip).it ems

Everything else is the same.
To copy files out of the ZipFile do:

---------------------- Cut Here ------------------------------------
CopyTo = "C:\test"
ZipFileName= "G:\Downloads\2 0071121.zip"

Set oApp = CreateObject("S hell.Applicatio n")
oApp.NameSpace( CopyTo).CopyHer e(oApp.NameSpac e(ZipFileName). items)
---------------------- Cut Here ------------------------------------

It will extract all the files in the zip file.
Please Post Any Replies To This Message Back To the Newsgroup.
There are "Lurkers" around who can benefit by our exchange!
Nov 23 '07 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2366
by: Robin Cull | last post by:
Hi all, I'm writing a script that needs to do lookups on the UNIX passwd and groups file on textual usernames/group names and return numeric UID/GID. Something that gives access to the C standard libarary functions getent(), for example. I've Googled around on various logical search terms and looked through pydoc and the module reference but haven't found anything up to this point. I'd have thought that the os module would provide...
2
2588
by: Robert Rothenberg | last post by:
I am working on a module that when given a CPAN distribution, will return which modules the distribtion requires (by parsing the Makefile.PL using Module::MakefilePL::Parse if the META.yml file is not available). A companion module will actually try to fetch the distribution information from CPAN (since it can query a .meta file if it exists before downloading an entire distribution). Because it is more closely tied to CPAN and works...
67
4288
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++. That usually serves to divert the discussion from the technical subject to a discussion of the...
109
5940
by: Andrew Thompson | last post by:
It seems most people get there JS off web sites, which is entirely logical. But it is also a great pity since most of that code is of such poor quality. I was looking through the JS FAQ for any question that identifies the warning signs to look out for, the things that most easily and clearly identify the author of code as something less than a master of the art. I did not find an FAQ that answered it, but I think the FAQ
1
2268
by: John | last post by:
Hi First of all apologies for posting so much code but this is rather involved and I am totally stumped. Basically I have a main form (Staff Batch SMS/E-Mail) which calls a function (SendSMS) in a module with in turn calls a form (frmInet) which contains an ms internet control (Inet1). Problem is that once the function Send SMS returns and the code tries to close the main form a 'Runtime error 2486: You can't carry out this action at...
6
2350
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any solution. My code can be downloaded from here: http://www.tprimke.net/konto/PyObject-problem.tar.bz2. There are some scripts for GNU/Linux system (bash to be precise). All you need to know is that there are four classes. (Of course, you may...
2
1354
by: Thomas Girod | last post by:
Hi. I found a lot of documentation about how to code in Python, but not much about how you organize your code in various modules / packages ... As I am not yet used to python, this puzzle me a bit. So, can anyone explain how one should organize and store its code ? the uses of __init__.py files ? Maybe my question is not very clear, but I hope someone will understand anyway ...
34
1931
by: Alan Larsson | last post by:
Is there a way i can look at the php code that is runnig a site, without any ind of admin access to the server?
0
2025
by: Rich Healey | last post by:
AON LAZIO wrote: Aon, Please keep these replies on list (I've CC'd the list now). This isn't actually a very long error message, but since email is a scrollable medium including long messages often isn't too bad. If you're worried, include a link to a pastebin.
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7644
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.