File: win32.html

package info (click to toggle)
fox 1.0.52-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,788 kB
  • ctags: 13,384
  • sloc: cpp: 96,482; sh: 8,338; ansic: 1,935; makefile: 1,010; perl: 32
file content (397 lines) | stat: -rw-r--r-- 16,629 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<html>
<head>
<LINK REL="stylesheet" HREF="styles.css" TYPE="text/css">
<title>FOX-Toolkit</title>
<!-- HTML Copyright 2001 Paul Laufer -->
</head>

<body bgcolor=#ffffff link=#990033 vlink=#4a73ad alink=#ed004f text=#000000>

<!--header-->
<table align=center border=0 cellpadding=0 cellspacing=0 width=100% >
  <tr><td bgcolor=silver colspan=5 align=right height=50><img src=art/oul_grey.gif align=left valign=top width=8 height=8><img src=art/foxlogo.png valign=bottom alt="FOX Toolkit" height=50 width=500 border=0 ></td>
  	<td bgcolor=#557faa valign=top align=right><img src=art/our.gif width=8 height=8></td>
  </tr>
<!-- end header -->
  <tr>
    <td bgcolor=#557faa colspan=2 valign=top align=left>&nbsp;</td>
    <td bgcolor=#557faa colspan=3><font color=#ffffff size=+1><center>
<!-- Page Title -->
Documentation: Developing Win32 GUI Applications Using FOX
<!-- End Page Title -->
    </center></font></td>
    <td bgcolor=#557faa valign=top align=right>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor=#557faa colspan=2>&nbsp;</td>
    <td bgcolor=#ffffff valign=top align=left><img src=art/iul.gif width=8 height=8></td>
    <td bgcolor=#ffffff>&nbsp;</td>
    <td bgcolor=#ffffff valign=top align=right><img src=art/iur.gif width=8 height=8></td>
    <td bgcolor=#557faa width=15>&nbsp;</td>
  </tr>
  <tr>
    <td width=8 bgcolor=#557faa>&nbsp;</td>
    <td valign=top bgcolor=#557faa link=#ffffff width=150>

<!-- start navbar content -->

	<a href=fox.html><font color=#ffffff>Home</font></a><br>
	<a href=news.html><font color=#ffffff>News</font></a><br>
	<a href=download.html><font color=#ffffff>Download</font></a><br>
	<a href=goals.html><font color=#ffffff>Goals & Approach</font></a><br>
	<a href=doc.html><font color=#ffffff>Documentation</font></a><br>
	<a href=faq.html><font color=#ffffff>FAQ</font></a><br>
	<a href=rex.html><font color=#ffffff>FXRex</font></a><br>
	<a href=screenshots.html><font color=#ffffff>Screenshots</font></a><br>
	<br>
	<a href=adie.html><font color=#ffffff>Adie</font></a><br>
	<a href=pathfinder.html><font color=#ffffff>PathFinder</font></a><br>
	<a href=calc.html><font color=#ffffff>FOX Calculator</font></a><br>
	<br>
	<a href=projects.html><font color=#ffffff>Projects</font></a><br>
	<br>
	<a href='http://fxpy.sourceforge.net'><font color=#ffffff>FXPy</font></a><br>
	<a href='http://fxruby.sourceforge.net'><font color=#ffffff>FXRuby</font></a><br>
	<a href='http://eiffelfox.sourceforge.net'><font color=#ffffff>EiffelFox</font></a><br>
        <a href='http://eevolved.com/foxhole/'><font color=#ffffff>The FOX Hole</font></a><br>
        <a href='http://takahr.dhis.portside.net/cgi-bin/rwiki.cgi?cmd=view;name=FOX+FAQ'><font color=#ffffff>Japanese Docs</font></a><br>
	<br>
	<center>
	<a href="http://www.eff.org/br"><img SRC="art/freespeach.gif" border=0></a>
	<p>
	<a href="http://www.slashdot.org"><img SRC="art/slingerzbutton1.gif" border=0></a>
	</center>



<!-- end navbar content -->

    </td>
    <td bgcolor=#ffffff>&nbsp;</td>
    <td valign=top>

<!-- start main window content -->
<center><img src='art/foxstart.png'>
<BR><B>Documentation: Developing Win32 GUI Applications Using FOX</B>
</center>
<p>
<p>
<b>Introduction</b>
<hr>
FOX provides a nice platform-independent alternative to the traditional
GUI frameworks for Win32 (namely MFC). While most of the other FOX documentation
applies to FOX programming in general, this document deals specifically
with some of the logistical details of creating a FOX-based application
for Windows. Many thanks to <a href="mailto:gehriger@epfl.ch">Daniel Gehriger</a>,
who provided a lot of the information you see here!
<p>
<p>
<b>Compilers and Development Tools</b>
<hr>
One goal is for FOX to work with as many different compilers and development
environments as possible. We have used Microsoft Visual C++ versions 5.0
and 6.0, Borland C++ Builder 3.0 and gcc (or egcs) to build FOX applications
for Windows. The standard FOX source code distribution includes project
workspace files for Microsoft Visual C++ 6.0 as well as make files for
Borland C++. You may also be able to use the Visual C++ project files with
Visual C++ 5.0, but this is unconfirmed at present. For detailed information
about how to build the library itself, please refer to the <tt>INSTALL</tt>
file which is found in the top-level directory of the standard FOX distribution.
<p>
<p>
<b>Using Microsoft Visual C++ 6.0</b>
<hr>
This section, and the following two sections, deal specifically with
FOX development under Microsoft Visual C++ 6.0. This discussion assumes
that you are at least <i>minimally</i> familiar with how to use Visual
C++ 6.0. In particular, you should know how to create a new project workspace,
and then add new project(s) to that workspace. Most of this information
should be useful for Visual C++ 5.0 as well, although some settings may
appear in different places.
<ol>
<li>
<b>Create the project.</b> All FOX applications are just standard Win32
applications, so when you create a new project select that option:</li>
</ol>

<center><img SRC="art/win32-project.png" height=400 width=561></center>

<ol>
<li>
<b>Open the Project Settings dialog for this project.</b> You will want
to make changes for both the compile-time options and link-time options
of this project. Choose the <i>Settings...</i> option from the <i>Project</i>
pulldown menu. Change to the "C/C++" tab and then select "Preprocessor"
from the "Category" drop-down list:</li>
</ol>

<center><img SRC="art/win32-preprocessor.png" height=372 width=577></center>

<ol>
<li>
<b>Modify preprocessor definitions for linking against the FOX DLL.</b>
The FOX library can be built as either a static library or a dynamic link
library (DLL). If you prefer to link your application against the DLL version
of the library, you will need to add FOXDLL to the preprocessor definitions
(not shown above).</li>

<li>
<b>Modify preprocessor definitions for OpenGL.</b> If you plan to use FOX's
OpenGL-related features you should also add HAVE_OPENGL to the preprocessor
definitions (as shown).</li>

<li>
<b>Add FOX's include directory to the list of "Additional include directories".</b>
This setting is on the "Preprocessor" page too!</li>

<li>
<b>Add the FOX library to the list of input libraries for this application.</b>
Now change to the "Link" tab of the Project Settings dialog box, and select
"Input" from the "Category" drop-down list (see below). Add the appropriate
library name (<tt>foxd.lib</tt> or <tt>foxdlld.lib</tt> for Debug builds;
or <tt>fox.lib</tt> or <tt>foxdll.lib</tt> for Release builds) to the list
of libraries under "Object/library modules".</li>
</ol>

<center><img SRC="art/win32-libraries.png" height=372 width=577></center>

<ol>
<li>
<b>Add FOX's lib directory to the "Additional library path".</b> This setting
is also on the "Input" page.</li>

<li>
<a NAME="mainCRTStartup"></a><b>Change the entry-point symbol.</b> Now
select "Output" from the drop-down list on the "Link" tab and type <b>mainCRTStartup</b>
in the "Entry-point symbol" type-in field (see below). Note that this field
is empty by default. This setting tells the linker to use your application's
<tt>main()</tt>
function as the entry point instead of the standard <tt>WinMain()</tt>
function.</li>
</ol>

<center><img SRC="art/win32-linkoutput.png" height=372 width=577></center>

<p>
<p>
<b>Common Problems</b>
<hr>
This section lists some commonly encountered problems for building Win32
applications with FOX.
<p><b>Unresolved symbols at link time.</b> If you get one or more "error
LNK2001" messages at link time, this usually means you've omitted required
libraries from the list. Open the Project Settings dialog and change to
the "Link" tab. On this tab, choose "Input" from the "Category" drop-down
list. Finally, add the missing libraries to the list under "Object/library
modules". Here is a list of commonly forgotten libraries:
<br>&nbsp;
<center><table BORDER CELLPADDING=5 WIDTH="77%" BGCOLOR="#FFFFCC" >
<tr BGCOLOR="#FFFFCC">
<td VALIGN=TOP>
<center><b>If the error message is...</b></center>
</td>

<td>
<center><b>You need</b>
<br><b>this library</b></center>
</td>
</tr>

<tr>
<td><tt>foxd.lib(FXPrintDialog.obj) : error LNK2001: unresolved external
symbol _EnumPrintersA@28</tt></td>

<td><tt>winspool.lib</tt></td>
</tr>

<tr VALIGN=TOP>
<td><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegCloseKey@4</tt>
<br><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegEnumKeyExA@32</tt>
<br><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegCreateKeyExA@36</tt>
<br><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegOpenKeyExA@20</tt>
<br><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegEnumValueA@32</tt>
<br><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegSetValueExA@24</tt>
<br><tt>foxd.lib(FXRegistry.obj) : error LNK2001: unresolved external symbol
__imp__RegDeleteKeyA@8</tt></td>

<td><tt>advapi32.lib</tt></td>
</tr>

<tr>
<td><tt>foxd.lib(FXApp.obj) : error LNK2001: unresolved external symbol
__imp___TrackMouseEvent@4</tt></td>

<td><tt>comctl32.lib</tt></td>
</tr>
</table></center>

<p>On the other hand, if you get this error message:
<blockquote><tt>MSVCRTD.lib(crtexew.obj) : error LNK2001: unresolved external
symbol _WinMain@16</tt></blockquote>
this indicates that you forgot to change the application's entry-point
symbol to <b>mainCRTStartup</b>. See <a href="#mainCRTStartup">this section</a>
for the details.
<p><b>Missing support for JPEG or PNG images.</b> If you're trying to use
the FXJPEGIcon, FXJPEGImage, FXPNGIcon or FXPNGImage classes and it doesn't
seem to be working, it's possible that the FOX library was not compiled
correctly to include support for these image formats. Load the FOX library
project into Developer Studio and then launch the <i>Project Settings</i>
dialog box. On the C/C++ tab of this dialog box, look at the list of preprocessor
definitions and confirm that HAVE_JPEGLIB_H (for JPEG support) and/or HAVE_PNG_H
(for PNG support) are defined. You will also want to be sure that the compiler
can find its way to the JPEG and PNG header files, so make sure the include
paths are correct as well. Note that these settings are only relevant for
building the FOX library itself; you don't need to have HAVE_JPEGLIB_H
or HAVE_PNG_H defined when compiling your FOX-based application code, nor
do you need access to the JPEG or PNG header files. You <b>will</b> need
to link your applications to the JPEG or PNG libraries, however.
<p>
<p>
<b>Other Tips...</b>
<hr>
<ol>
<li>
If you find yourself using FOX on a regular basis (as we hope) you might
want to add its installation directory to the lists of standard directories
searched by Visual C++ for include files and libraries. To do this, open
the Options dialog by selecting the <i>Options...</i> command from the
<i>Tools</i>
pulldown menu, and switch to the "Directories" tab:</li>
</ol>

<center><img SRC="art/win32-tooloptions.png" height=319 width=417></center>

<blockquote>Select "Include files" from the "Show directories for:" drop-down
list and the list of directories should show the default include path (in
order). Add your FOX installation's <b>include</b> directory to the end
of the list. Then select "Library files" from the drop-down list and add
your FOX installation's <b>lib</b> directory that list.</blockquote>

<ol>
<li>
If you do link your executables against the FOX DLL, the executable needs
to find it in the path when it runs. You can copy this DLL by hand to some
directory in the path, but you may want to instead make the following modifications
to automatically copy the DLL into your application's build directory (requires
Windows NT). Start by opening the Project Settings dialog box and change
to the "Post-Build Step" tab (it's on the far right, you'll need to scroll
over to see it!)</li>
</ol>

<center><img SRC="art/win32-postbuild.png" height=372 width=577></center>

<blockquote>Add a description such as "Updating DLL..." to indicate what's
going on; this message gets printed to the Build output window in Developer
Studio when these commands are executed. Then, add the following two commands
to the "Post-build command(s)" list:</blockquote>

<ol>
<blockquote><tt>REPLACE C:\src\fox\lib\foxdlld.dll /U Debug</tt>
<br><tt>IF NOT EXIST Debug\foxdlld.dll COPY C:\src\fox\lib\foxdlld.dll
Debug</tt></blockquote>
You should, of course, use the correct path to the DLL for your FOX installation.
You should also be sure to copy the release build of the DLL (named <tt>foxdll.dll</tt>)
to your project's <tt>Release</tt> subdirectory, if that's the configuration
you're configuring.
<br>&nbsp;
<li>
You may want to add the <b>fox</b> or <b>foxdll</b> project (<tt>fox.DSP</tt>
or <tt>foxdll.DSP</tt>) to your own workspace, and configure a dependency
from your application's project to the appropriate library's project. You
can do this by selecting the <i>Dependencies...</i> option from the <i>Project</i>
pulldown menu, to open the Project Dependencies dialog box. That way you
can simply unpack a new FOX drop over the existing tree and your project
will first re-compile the new files before compiling your project.</li>
</ol>
<p>
<p>
<b>Using the MinGW Compilers</b>
<hr>
<p>
The FOX library, and FOX-based applications, can now be built using
the MinGW compilers and related Unix-like tools. If you are not familiar
with this development option, but would like to know more, I recommend
starting with the <a href="http://www.mingw.org/mingwfaq.shtml">MinGW FAQ
list</a>.<p>

<b>Disclaimer.</b> The process described here has been tested using the
most recent release of the Cygwin tools (i.e. the 1.1.x series) and the
MinGW tools, under Windows 2000.
<p>To get started, you will need to download and install the following
packages:
<ul>
<li>
The <a href="http://sources.redhat.com/cygwin">Cygwin</a> tools, or
some reasonable substitute. You will at least need a bash-compatible shell
and GNU make version 3.76.1 or earlier;
</li>
<li>
The latest <a href="http://www.mingw.org">MinGW</a> distribution; and,
</li>
<li>
The latest <a href="http://www.fox-toolkit.org/fox.html">FOX</a> distribution;
</li>
</ul>
If you want to use OpenGL, you'll also need to download the OpenGL header
files MinGW; they are not a standard part of the packages listed above.
Check the <a href="http://www.mingw.org/mingwfaq.shtml">MinGW FAQ list</a>
for more information about how to develop OpenGL applications using MinGW.<p>

Now, because of some problems with the version of make distributed with
MinGW (currently, make-3.77) you'll need to use an earlier version of make,
such as the one distributed with the Cygwin tools (make-3.76.1). Ensure that
the correct version of make is picked up by either renaming or deleting
the version of make distributed with MinGW.<p>

Next, unpack the FOX distribution somewhere by typing, e.g.,
<blockquote>
    <tt>tar xzf fox-0.99.149.tar.gz</tt>
</blockquote>
and then go to the top-level directory of the FOX distribution and type:
<blockquote>
    <tt>./configure</tt>
</blockquote>
If <tt>configure</tt> stops rather quickly, right after it prints the message
about "checking whether make sets ${MAKE}", it's picking up the wrong version
of make (see the notes a few paragraphs earlier).<p>

Once <tt>configure</tt> is finished doing its thing, and assuming there
were no errors, build the library and supporting executables by typing:
<blockquote>
    <tt>make</tt>
</blockquote>
and then sit back and wait ;)
<!-- end main window content -->

    </td>
    <td bgcolor=#ffffff>&nbsp;</td>
    <td bgcolor=#557faa width=15>&nbsp;</td>
  </tr>
  <tr>
    <td colspan=2 bgcolor="#557faa" align=center>&nbsp;
     </td>
    <td bgcolor=#ffffff valign=bottom align=left><img src=art/ill.gif width=8 height=8></td>
    <td bgcolor=#ffffff>&nbsp;</td>
    <td bgcolor=#ffffff valign=bottom align=right><img src=art/ilr.gif width=8 height=8></td>
    <td bgcolor=#557faa width=15>&nbsp;</td>
  </tr>
  <tr>
    <td valign=bottom align=left bgcolor=#557faa><img src=art/oll.gif width=8 height=8></td>
    <td colspan=4 bgcolor=#557faa>&nbsp;</td>
    <td valign=bottom align=right bgcolor=#557faa><img src=art/olr.gif width=8 height=8></td>
  </tr>
</table>

<address>Copyright 1997-2002 <a href=mailto:jeroen@fox-toolkit.org>Jeroen van der Zijp</a></address>
<!-- Created: Mon Apr 10 11:20:32 CEST 2000 -->
<!-- hhmts start -->

<!-- hhmts end -->
</body>
</html>