1<html><head>
2	<title>Metakit sample code - KitBinder</title>
3</head><body bgcolor=white>
4
5<font face=Helvetica size=3>
6
7<!--begin-->
8<h2><img src="e4app.gif" alt="App Icon" border=0 align=left>
9Metakit sample code - KitBinder</h2><br clear=left>
10<p>
11This application is a generic utility for the Metakit library.
12<p>
13<b>What it does</b>: KitBinder is a utility program which converts any
14Metakit datafile into a format suitable for embedding as resources inside
15an excutable program.  The current version supports Win16 and Win32.
16<p>
17<b>What it illustrates</b>: KitBinder further enhances the stand-alone
18nature of Metakit by allowing you to package read-only data as part of
19your application, to simplify deployment and installation.
20Compression is used to further reduce the size of this read-only data,
21the resources can optionally be encoded to protect sensitive data.
22<p>
23<b>How to use it</b>: To use these resources, you must make some very
24simple changes to your code, using the "c4_BoundStorage" class
25which is part of the KitBinder sample code.
26<p>
27Here is some more information from the "kbound.h" file:
28<blockquote><table width=550 cellpadding=10 cellspacing=0 border=1><tr><td>
29    The process of switching to bound data is quite simple:
30<p>
31<ol>
32	<li> Presumably, you have a Metakit datafile with some data in it.
33            Let's assume it is now stored in a file called "try.dat".
34	<li> Create source files for the resource editor (Win32):
35                <u>kbinder try.dat kbtry</u>,
36            or for Win16, use a text format instead:
37                <u>kbinder -t try.dat kbtry</u>.
38	<li> This produces a file called "kbtry.rc", as well as one or more
39            files called "kbtryXXX.res" (or "kbtryXXX.rc" if text format).
40	<li> Add the following line to your application resource file:
41                <u>#include "kbtry.rc"</u>
42	<li> Include the file "kbound.h" to define the c4_BoundStorage class,
43            and include the code which is in "kbound.cpp" in your project.
44	<li> Create your storage object from the class "c4_BoundStorage",
45         ie. change:
46                <u>c4_Storage myStorage ("try.dat", false)</u>;
47            to
48                <u>c4_BoundStorage myStorage</u>;
49	<li> That's it, you now have a read-only copy of "try.dat" bound to
50            your application and no longer need that data file at run time.
51            Everything will continue to work, but you cannot commit changes.
52            You can however call DumpAsRes, or c4_Storage::SaveToStream.
53</ol>
54<p>
55    For the original comments about the compression code, see "kboundw.cpp".
56<p>
57    To use encoding, you need to point c4_BoundStorage::_Encoder to an
58    appropriate function before creating any instances of c4_BoundStorage.
59</td></tr></table></blockquote>
60<p>
61The "kbdump" program is a example based on some code taken from the
62"Dump" utility.  When you run it, it will dump a sample datafile
63(the catalog of the Metakit 1.5 release).  That data was bound using the
64procedure described above, and is embedded in the "kbdump" executable.
65<p>
66<b>Known problems</b>: None.
67<p>
68<b>Files in EXAMPLES\KN\BIND</b>:
69<p>DUMP.CPP - Dump main program 
70<br>DUMP.MAK, DUMP.MDP - MSVC 4.2 project makefiles for Win32
71<!--end-->
72
73<center><p><hr size=1>
74||
75&nbsp; <a href="index.html" target="_top">Roadmap</a>
76&nbsp; <a href="classes.html">Class Index</a>
77&nbsp; <a href="samples.html">Sample Index</a>
78&nbsp; ||
79&nbsp; <a href="intro.html">Introduction</a>
80&nbsp; <a href="tips.html">Tips and Tricks</a>
81&nbsp; || 
82
83</center>
84</font>
85
86</body></html>
87