Bekz.net - (14016 of 825949 - 2%) 

 Home | Tips & Tricks | General Info | Downloads | NG Archive | Links | Email | Search | Register | Users | Login

 


 

 

FiveWin.info Poll
What is your primary used RDD
DBFNTX
DBFCDX
DBFMDX
DBFNDX
DBPX ( Paradox )
SIX ( ApolloRDD )
ADS ( Advantage )
SQL server
Other


View results so far
View old polls
 

 

 

General Info

 

Back to list

FiveWin in Practice Part 1 By Patrick Mast

FiveWin in Practice 1


FiveWin in Practice

By Patrick Mast

INTRODUCTION 
This is the first in a series of articles that will be dedicated to writing applications using FiveWin.  We will create a FiveWin application from scratch.  But before that we’ll review the tools we need, get them installed and configured and then we will get started on our FiveWin application!.

TOOLS
First things first. What tools do we need? Well, we need a compiler, the FiveWin library, a linker and optionally a resource painter.
In this article we will use CA-Clipper versions 5.2e or 5.3b as the compiler.  Later on with FiveWin++ we will use Xbase++.  So what’s the difference?

FiveWin applications built with CA-Clipper are 16 bits Windows applications and those built with Xbase++ are fully 32 bits apps. The source code of our FiveWin applications will stay  exactly the same! This is the main advantage of FiveWin / FiveWin++, we’ll use the same source code for 16 as well as 32 bits applications! We can even use the resource files (DLL or RC) from our 16 bits application with FiveWin++.

The latest version of FiveWin is 1.9.5 service pack 5, FiveWin++ is in version 1.0 March build. Info and upgrades can be found at www.fivetech.com. Now we have the compiler and the Windows lib, next thing we need is a linker. The best choice here is Blinker 5.1 ( www.blinkinc.com ). The main advantage of version Blinker 5.1 over 5.0 is that version 5.1 has a greatly increased eval stack and static variable space. Things we certainly can use as our FiveWin application grows.

Blinker 5.1 also can compress our exe file!  A none compressed exe of 1.6Mb will get compressed to around 650Kb, and this with no execution speed difference!

We also need a good source code editor!   My choice is Multi-Edit. www.multiedit.com .  It’s a first class editor which I almost use as a IDE. You can let it work exactly as you want. Macro’s, VCS (Version Control System) Multi-Edit has it all!

The Last tool we gonna use is a Borland’s Resource Workshop. This is a tool to paint all of our dialogs, bitmaps and icons. The latest version is 4.5. You can find it on the net at  www.borland.com/borlandcpp/cppcomp/reswkfct.html   Borland’s Resource Workshop sells for $69.95 now at borland.com. It’s a great buy!

Ok, we are now ready to start!   Here we go!

 

FIRST APPLICATION
Before we begin writing source code let’s create a make a .MAK file. This way all the compiling and linking can be done with one command. Lets call our first app First.exe. For this we’ll create a file First.mak:

---BEGIN FIRST.MAK---
makepath[.Prg]=".\Prg"
makepath[.Obj]=".\Obj"

.Prg.Obj:
  
lh clipper $< /O$@ /n/w >> meerr.tmp

First.Obj:   First.Prg

First.Exe: First.Obj
 
blinker @First.lnk

---END FIRST.MAK---

Via the makepath Rmake.exe knows where to put the obj files and where to get the prg(source) files.

Tip: run the clipper.exe file in high memory. This way you get more memory to handle all the include files.

The output of the compiler to meerr.tmp is for Multi-Edits error tracking. This way Multi-Edit knows what compiler error you’ve got, so it can point directly to the error line in the source. Works great!

Next thing: The link file.

---BEGIN FIRST.LNK---
fi .\obj\First

BLINKER EXECUTABLE NODELETE
BLINKER INCREMENTAL OFF
BLINKER CLIPPER SYMBOL ON
BLINKER EXECUTABLE CLIPPER F220
PACKDATA
PACKCODE
NOEXTDIC
BLINKER EXECUTABLE COMPRESS
MAP A,S

DEFBEGIN
  name        First.exe
 
description Our First App!
  exetype     Windows 3.1
 
code        preload moveable discardable
 
data        preload moveable
 
stacksize   9500
 
heapsize    2048
 
segment     'PLANKTON_TEXT' nondiscardable
 
segment     'EXTEND_TEXT'   nondiscardable
 
segment     'OM_TEXT'       nondiscardable
 
segment     'OSMEM_TEXT'    nondiscardable
 
segment     'SORTOF_TEXT'   nondiscardable
 
segment     'STACK_TEXT'    nondiscardable
DEFEND

NOBELL 

fi .\obj\alloc 

SEARCH  Five, FiveC, Objects
LIB     WinApi, Clipper, Extend, DbfNtx, Terminal

out First.exe

---END FIRST.LNK---

Let me explain is short what’s in the link file.

BLINKER EXECUTABLE NODELETE : This prevents Blinker from deleting our .EXE file when there are errors while linking, or when there are unresolved externals.

BLINKER INCREMENTAL OFF : This turns off the Blinkers incremental feature. Blinker will not create a BIF file for the incremental linking.

BLINKER CLIPPER SYMBOL ON : If the .EXE crosses  the 64K Symbol space barrier, we need to set this ON

BLINKER EXECUTABLE CLIPPER F220 : The number of open files burned into the .EXE file

PACKDATA & PACKCODE : These commands specifies that Blinker should pack data segments and combine code segments. When the .EXE files grows you gonna need this.

NOEXTDIC : This command specifies that Blinker should ignore the extended dictionary which is appended to library files by some librarian utility programs

BLINKER EXECUTABLE COMPRESS : Compress our .EXE!

MAP A,S : Generates a .MAP file wich lists the address, length and name of each segment in the .EXE (A). Also lists the public symbols and their memory addresses. This comes in verry handy if you wanne track GPF’s.

NOBELL : Don’t beep when finished.

FI .\OBJ\ALLOC : You only need this file if you compile with CA-Clipper 5.2x. CA-Clipper 5.2 has a bug in alloc.obj module. This bug is fixed in CA-Clipper 5.3x. This new alloc.obj solves many DBF management potential errors.

This is a standard .LNK file that can be used for small AND big applications.

Ok, now that we have the .MAK file and the .LNK file we can start for the real thing: the source files! We gonna have two different source files for our First.EXE. One PRG files with the CA-Clipper code, and one file that contains the dialogs and other resources. There are two ways to create resource files. The first one is to put the resources in a DLL file, wich we load in the source file with LoadLibrary(). An other approach is that we save the resources in a .RC file, wich we than bind into the .EXE file. This way we don’t need to do a LoadLibrary(). For our First.EXE we gonna use the DLL approach.

(May 1999)

 

 

 

 

© 2002 Bekz.net, Inc. All Rights Reserved.