November 2007: Volume 16 Number 1

PFXplus and Vista | PFXweb | Companion Products SP4 | Email the Easy CDO Way | News, products update | Newsletters home page

PFXplus and Windows Vista

David Bennett – MD Powerflex Corporation – Australia

Here it is at last - the long awaited Windows Vista! The question many Powerflex developers have asked us is whether we support PFXplus under Vista. Of course the answer is yes. PFXplus is fully supported under Windows Vista, like all our products.

So we have been putting our products through their paces on Vista to see if there are any issues we need to address, and we've been getting feedback from those of our customers who have already taken the plunge.

Vista Issues

There are some issues caused by changes made to Vista which will affect all software developers, not just Powerflex.

Vista prevents most users writing to the Pro-gram Files directory, except in a few cases such as when you are running an installer. The effect is that while applications install correctly under Vista, you cannot edit the files in the Program Files directory.

If you try, Vista creates a virtual Program Files directory for each user which contains the edited files. This can be very confusing.

We recommend you still install PFXplus into the Program Files directory but do not attempt to modify any of the files there. If you need to edit any of the files such as PFX.INI, STANDARD.PFI or the sample program data files, copy them to a new directory and edit them there. Make sure that you include the new directory in sDataPath.

Vista no longer recognizes the .hlp help files which have been part of Windows for a very long time. There is a Microsoft download to allow the use of .hlp files, but this should only be seen as a short term solution. We are currently migrating to a new help system which will run under Vista.

PFXplus Issues

In our testing so far we have identified only two PFXplus issues running under Vista.

PrtPrintDialog, which was known to crash occasionally under XP, crashes often under Vista. As well, the PFXplus icon sometimes stays on the task bar after a PFXplus application has been shut down. Both will be corrected in the next service pack.

In general PFXplus and all of our other products transition quite smoothly to Windows Vista with few problems.

The one exception is PFXweb. The desktop parts work just fine, but Vista seems not to be designed for use as a server, and the server part does not currently install.

Make The Move

So far we have not found a great rush of Powerflex customers migrating immediately to Windows Vista. Most people seem to be waiting for the first Vista service pack or perhaps a hardware upgrade before they make the change.

You can be sure that when you do, your PFXplus applications can migrate with you.

Top of Page

Introducing PFXweb

Chris Babarczy - Powerflex Corporation, Australia

If you have visited the Powerflex website recently you will have noticed that we have released our new internet product, PFXweb. PFXweb is our exciting new software which is particularly significant for PFXplus and Dataflex developers because:

  • You can take existing PFXplus or Dataflex applications and convert them to run them on the Internet
  • You can achieve exceptional performance for forms-based business applications.

What You Get

PFXweb is available for Windows 32 bit or Windows 32 bit with SQL support and is comprised of three main components.

  1. The powerful PFXweb version of the PFXplus runtime engine, designed to be installed on a server
  2. A pre-built website, including many sample programs
  3. A PFXweb template to help you start building your own applications.

These components will help you to quickly get started converting your existing applications or developing new ones by using the comprehensive samples we provide.

As always, we will provide unlimited support to VAR members if you require help getting your applications up and running.

System Requirements

To run PFXweb, your server requires either Windows XP with SP2 or Windows 2003 Server. IIS should be enabled and .Net Framework 2.0 should be installed. The only requirement for the client is Internet Explorer 6 or later with Javascript enabled.

Of course, you will also need a copy of PFXplus to compile your programs. The minimum requirement is PFXplus Development System v5.0 with SP4.

PFXweb Licencing

While PFXweb is perfectly suitable for general Internet applications, it is intended mainly for the extra-net or intra-net markets.

These are the areas for which the majority of existing Powerflex applications have been developed, and we felt our initial responsibility was to provide an easy way of converting these applications to web applications.

Therefore, PFXweb is licensed similarly to PFXplus for Windows runtimes. PFXweb is available for installation on a single server in blocks of 5 users, where each user represents a single logged-in session.

Please contact us for PFXweb pricing.

Top of Page

Powerflex Companion Products Service Pack 4

Gerard Nolan - Powerflex Corporation, Australia

Service Pack 4 for PFXbrowse, PFXsort and PFX C-lib 5.0 has just been released. This service pack contains updates for each of these products ranging from significant enhancements to PFX C-lib to a minor problem fix for PFXsort.

The updates are the result of customer feedback and support requests and reflect our commitment to keeping our products current with industry trends and our customers' requirements.

Details of the additions and changes to each of the products are listed below.

New Features - PFXbrowse

Pervasive Btrieve version 9 and Microsoft SQL Server 2005 are now fully supported.

Changes - PFXbrowse

A problem which gave an error 51 (cannot update without lock) when an attempt was made to delete a record and the bLockRequired configuration item was either missing or set to True, has been fixed.

A problem that caused negative numbers to be corrupted during the updating of a record displayed in a form view or as the last record view has been fixed.

A performance problem in Mark 4 (Btrieve) files in finding the end of a file has been corrected.

The title-bar and the about box now more accurately reflect the built in capabilities of the product and the licence.

New Features - PFX C-lib


The CFG_DATAPATH items PclSetConfig and PclGetConfig will now use and return a string up to 4096 characters in length.

Data files (DAT) and index files (K1-K16) of a size greater than 2GB on a Windows 32 system running 9x/2000/XP are now supported. Mark3 VLD files are limited to 2GB. Mark4 and Mark5 are not affected.

The default for the iMaxFiles and iMaxHandles configuration items has been increased to 500 for the Windows runtime.


Pervasive Btrieve versions 8 and 9 are now fully supported.

Case insensitive indexes on Mark4 (Btrieve) files are now supported. This functionality is only available for Btrieve files created by Btrieve version 6.10 and above.

New Btrieve configuration item iBtrievePageoffset. Recnums are now correctly calculated for Btrieve 7 files which do not have the system data attribute. The iBtrievePageoffset configuration item sets the Btrieve Page Offset which corresponds to a recnum of 1. The corresponding PclGetConfig item is CFG_BTRPAGEOFFSET.

New SQL File Version - Mark 5B

Mark 5B is a new file version that avoids the need for either special index columns in SQL tables or updating the PFXFILES table. A Mark 5B file uses native SQL column indexing rather than special index columns (PFXINDEXn), and a native SQL auto-increment column as the RECNUM column.

In general, the performance of Mark 5B tables is significantly faster when adding new records. Certain kinds of finds especially on indexes with many segments may be slower.

Mark 5A remains the default when a generic Mark 5 file is created. This default can be changed by setting a new configuration item iSqlCreateMode or a PclSetConfig with argument CFG_SQLCREATEMODE, or the file type can be specified when created.

Mark 5B tables can be created using PclCreateFile with argument FV_MARK_5_SQLB. Mark 5A tables can be created with argument FV_MARK_5_SQLA. Using PclCreateFile with the argument FV_MARK_5 will create either a Mark 5A or 5B table depending on the setting of iSqlCreateMode or as set by a call to PclSetConfig using the argument CFG_SQLCREATEMODE.

The PclFileDef command now returns FV_MARK_5_SQLA or FV_MARK_5_SQLB as the ftype value instead of FV_MARK_5 in previous versions.

The collating sequence used in Mark 5B is that of the underlying SQL engine, rather than that used by the runtime as in Mark 5A. This represents a significant change (especially to string fields) which may affect some programs.

The case-insensitive flag that can be used on each segment of an index in Mark 5A is not supported in Mark 5B.

Mark 5A and Mark 5B tables can exist together in an SQL database and there have been no changes to the structure of the PFXFILES, PFXFIELDS and PFXINDEXES columns. However, the data stored in these tables is different for the two variants.


MS SQL 2005 is now fully supported. Previously MS SQL 2005 was supported only if it was set to SQL 2000 compatibility.

PclGetExtError now returns a more specific SQL error code. Previously the generic code of -1 may have been returned often. Now -1 is only returned if there is no other information returned by the ODBC driver.

SQL columns of the Unicode types SQL_WCHAR, SQL_WVARCHAR and SQL_WLONGVARCHAR may now be used.

Configuration item iSqlCacheOpens con-trols the in-memory caching of SQL struc-ture data, which significantly speeds up re-opening of files that have been closed.

0 use default value (currently 2 for all da-tabase drivers)
1 disable feature, no caching
2 enable feature, caching in effect

Configuration item iSqlCreateMode has been added to specify that the creation of Mark 5 files default to Mark 5A or Mark 5B. The values are

0 create Mark 5 files as type Mark 5A (default)
1 create Mark 5 files as type Mark 5B.

The PclSqlExec function @DRIVERCONNECT can be used to connect to an ODBC driver using an SQL driver connection string.

Changes - PFX C-lib


The upper limit of approximately 700 for the iMaxFiles configuration item has been removed.

Setting a FILE_MODE with PclSetMode on an in-memory table is now ignored. Previously, setting a FILE_MODE on an in-memory table could generate a signal 11.

File handle recycling now correctly starts when the upper limit of the number of Operating System file handles is approached. Previously, file handle recycling may have started earlier when certain error conditions were encountered.

The file header is now refreshed during the PclFileDef call to ensure that the current number of records in the file is correct.

A problem with calculating the number of passes needed to reindex a large file has been corrected.

The default value of bLockRequired is now correctly set to True.

An error is now generated when more than 32767 handles are allocated with PclAllocFile without freeing some of them (with PclFreeFile). Previously, an infinite loop occurred in this situation.

A call to PclPutField on a date field with the buffer containing a string of less than 10 characters now sets a null date. Previously an incorrect date could be stored.

Previously, a call to open an in-memory table using PclOpenPseudo with a record length set to less than 6 bytes would return an error. This has been corrected.


For Mark 4 (Btrieve) files PclGetInfo now returns the correct value of the current number of records when called with an ar-gument of PCH_RECORDCOUNT.

The Powerflex Btrieve libraries now correctly handle negative numbers when a Find LE, Find GE sequence is executed.

A rare problem in calculating a RECNUM has been corrected.

Finding records when a field value has been specified on a Mark 4 (Btrieve) file which contains no records now correctly returns Not Found (ERXNOFIND).

A performance problem in finding the end of a file has been corrected.

The saving of records which are later interpreted as deleted is no longer allowed.


Error 25 (ERXNOFIND) is now returned when PclSqlFetch is called on a file after a failed PclSqlOpen call on the same file.

A zero length string is now permitted as an argument to PclSetConstraint.

A call to PclSqlOpen that returns a result set with a record length of less than 6 bytes now succeeds and sets the in-memory table record length to 6. Previously error 61 (ERINVDEF) was returned.

A problem with multi-user safety if the PclIndexSet and PclReindex functions are used to create and reindex a temporary index on a Mark 5 file has been corrected. Previously, a "Violation of PRIMARY KEY constraint" SQL error could be returned if the file was in use by other users.

SQL columns under an overlap field when used in an index are now handled correctly. In previous versions some columns under an overlap field were left out of the created index.

SQL statement handles are now cached correctly. Previously the cache limit was too low and under some circumstances would cause a hang.

The library file PFXLIBNS.LIB now correctly targets PFXLIBNS.DLL. Previously it incorrectly targeted PFXLIBN.DLL.

The open option WHERE now correctly constrains all Finds.

The length of the FILE_NAME column in the PFXFILES table has been reduced from 255 to 254 due to changes in DB2 v8.x.

A problem which caused a GPF when an overlap field containing multiple columns was used in an index on Mark 5B files has been fixed.

Changes - PFXsort

A problem which caused the /Z option to truncate a DAT file if there were more deleted than non-deleted records on the file has been fixed.

Top of Page

Email the Easy CDO Way

Max Thomson - Powerflex Corporation

Have you ever wanted to add email capabilities to your PFXplus programs? We published a solution to this common problem previously but it depended on having access to Outlook or Exchange, and that does not suit everyone.

One of the lesser known features of Windows is Collaboration Data Objects or CDO. CDO is available on all Windows systems and can be used to send email independently of either Outlook or Exchange, although it does integrate with them if they are installed.

The other thing you need is the COM support that was added to PFXplus in SP4. This makes everything possible!

Just a Few Lines of Code

The following code is the basic requirement for setting up access to CDO and load in the type libraries that give access to the COM system.

// global strings and values for CDO
string SMTPServerName
integer SMTPServerPort
SMTPServerName =  ""
SMTPServerPort =  25
string FromAddress ToAddress Subject AttachmentPath
string TextBody 6000
string HTMLBody 6000
FromAddress = ""

// load the type libraries
LOAD_TYPELIB CDO from "{CD000000-8B95-11D1-82DB-00C04FB1625D}" 1.0
LOAD_TYPELIB ADO from "{00000205-0000-0010-8000-00AA006D2EA4}" 2.5

// create a configuration object to attach to each email
COM_OBJECT config_obj ISA CDO\Configuration
com_create Config_obj
ConfigMail SMTPServerName SMTPServerPort config_obj

The next block of code shows how to use the COM Object to send email by SMTP, that is, without using Exchange. The information is held in a configuration object that will be attached to each email.

procedure ConfigMail string smtpserver integer smtpport ;
                     COM_OBJECT CdoConfigObj
    COM_OBJECT CdoConfig ISA CDO\Configuration
    set CdoConfig = CdoConfigObj 
    #undefine Field
    COM_OBJECT AdoField  ISA ADO\Field
    COM_OBJECT AdoFields ISA ADO\Fields
    string msschema
    msschema = ""
    set AdoFields = CdoConfig\Fields
    set AdoField = AdoFields\Item(msschema+"sendusing")
    AdoField\Value = CDO\CdoSendUsing\cdoSendUsingPort
    set AdoField = AdoFields\Item(msschema+"smtpserverport")
    AdoField\Value = smtpport
    set AdoField = AdoFields\Item(msschema+"smtpserver")
    AdoField\Value = smtpserver

Finally, you need to send each email. The code for this is as follows. As you can see, this is very straightforward. There are many additional options such as ascending HTML mail or requesting receipt notification shown in the documentation.

// now create the actual message
com_create CdoMsg

// values	to set up for each email
ToAddress	= ""
Subject =	"Test message from Me"
TextBody = "This is a	test message sent by Me"
AttachmentPath = "D:\MyDocs\MyAttachment"

// Fill in to, from, subject, email contents, attachments etc..
CdoMsg\Subject = subject
CdoMsg\To	= toaddress
CdoMsg\From =	fromaddress
CdoMsg\TextBody =	textbody
CdoMsg\AddAttachment Attachmentpath "" ""
Cdomsg\Configuration = config_obj	// Attach Configuration Object
CdoMsg\Send // and send

A more complete version of this sample is part of PFXplus Service Pack 4 or can be downloaded here.

Top of Page

Powerflex News and Product Update

PFXcrystal v5.1 Supports Crystal Reports XI Release 2

Crystal Reports XI Release 2 from Business Objetcs is fully supported by PFXcrystal 5.1 with some minor adjustments. Contact us for full details.

Contributors Welcome

We are continually impressed by the ingenuity of PFXplus Developers and their habit of coming up with innovative ways to solve problems using the many powerful features of our products.

Have you written a snappy piece of code or overcome a tricky issue using Powerflex products? Would you like to share it with other developers? Then why not write an article for POWERlines? Anything from short technical tips to multi-page articles are welcome.

So if you have something to contribute to the Powerflex development community, contact us and we will help you get your ideas into print.

Top of Page

Current Versions of Powerflex Release Software

PFXplus Developer's Kit 32-bit for Windows/Btrieve/SQL incl SP2 5.0
PFXplus Runtimes 32-bit for Windows/Btrieve/SQL incl SP2 5.0
PFXweb Server for Windows/Btrieve/SQL 5.0
Service Pack 4 for PFXplus Developer/Runtime/PFXbrowse Dev & End User/PFXsort/PFX C-lib, for Windows/Btrieve/SQL, available to VAR members only 5.0
PFXplus for UnixWare incl SP2 5.0
PFXplus for AIX incl. SP2 5.0
PFXplus for Linux SP1 5.0
PFX C-lib 32 bit for Windows/SQL incl SP2 5.0
PFX C-lib for Linux 5.0
PFXsort for 32 bit Windows/SQL 5.0
PFXsort for UnixWare 5.0
PFXsort for Linux 4.41
PFXbrowse 32-bit Windows/Btrieve/SQL Developer version incl SP2 5.0
PFXbrowse 32-bit Windows/Btrieve/SQL End-user version incl SP2 5.0
PFXbrowse Developer for Linux 4.41
PFXodbc 32-bit Windows incl SP2 5.0
Service Pack 3 for PFXodbc 32 bit for Windows 5.0
PFXcrystal 32-bit Windows for Crystal Reports 9, 10 and XI 5.1
PFXplus HTML Help 5.0

Top of Page