PowerBASIC Tools

Code Generating Tools

This page has a collection of specialised code generation tools for creating true API style windows code in the PBDLL compiler. While there are other approaches to writing windows code in PowerBASIC, performance reasons bring most programmers back to to writing true API code as it is the most efficient in terms of size, speed and power. These tools are designed to improve the throughput for programmers who need to write true API code.

There are two seperate code generators for starting new projects or prototyping, one for window style code using CreateWindowEx(), the other for dialog style applications using the windows dialog engine through DialogBox(). Both use the standard PowerBASIC supplied files and do not require any other to create working program skeletons. Both project starting code generators produce very efficient code. These tools are designed to take a lot of the "hack" work out of writing operating system based code. There are some additional specialised tools and some archival earlier versions as well.

The download size on all of the current code generating tools is small enough to download all of the tools so that the complete range is available to programmers who need the performance of true API code.

Project and Prototype Tools

Pstart2b.zip
Version 2.00b has has some minor changes to its output code design. Prostart version 2 is a code generator for creating projects or prototyping ideas without the hack work of writing the basic front end. It Creates true API windows code using CreateWindowEx(). It has options to create a toolbar, a multi-pane status bar, file dialogs and other code options to more accurately tailor the generated code to your requirements. Minimum code starts at 8704 bytes and with all options, the code is just over 17k in size. You can build the EXE file directly from Prostart and interactively test the compiled EXE, change options and build it again until the output EXE file is built to your requirements.

This code generator puts API style code at your fingertips so that you can experiment with function design without the hack work of creating the front end to do it and it will create startup project code that you can build an application from. The generated code is built with a batch file called "MAKEPB.BAT" and will build as generated in the standard PowerBASIC editor.

Dbldr.exe
Dialog Builder 1.2 is a small code generator that uses the standard PBDLL60 files to build working EXE files in minutes. It is based on the Microsoft Dialog Editor that comes with PowerBASIC. It is easy to install and easy to use and it builds files that start at about 7.5k in size. It builds one of the simplest API styles of code available which is easy to modify and extend yet it pays no price in terms of performance.
This second version will generate additional code for text and checkbox processing and will generate subclass functions for list and combo boxes if needed.

Code Generating Accessory Tools

dlgproc.zip
DLGPROC is a code generating tool for creating the function call DialogBox() and the message handling proc for MODAL dialog boxes. Once the resource dialog template has been created, it takes 3 text inputs, a control identifier, a parent handle and a name for the message handling proc. It has a range of messages that can be selected that are commonly used in MODAL dialog boxes and many of these messages have commonly used code that is added when the procedure is created.

subclass.zip
SUBCLASS is a small code generation tool for quickly creating control subclass function for API style controls in either dialog or window style applications. It has the normal text options for the control handle, function name and the address variable name as well as a range of commonly used messages for subclassed controls. It is easy to use and creates the subclass function as well as the required SetWindowLong() function call and GLOBAL variable needed for the return address. It comes with a very simple demo program that uses a subclass function written in SUBCLASS. The attached README.TXT file has a simple explanation of how subclassed controls work. The interface was designed in the old Microsoft Dialog Editor and the template for the application was built in dbldr.exe.

Makewin.Zip
MAKEWIN is an accessory for Prostart.Exe and is designed for creating extra windows for applications being written. It is suitable for use with any API style code as long as the design is understood. It creates a function that creates the window and a message processing function for the window. It has a range of the most commonly used options for creating the window which include WNDCLASSEX, extended window styles and normal window styles. It also has the most commonly used messages as options for the message handling function.

Specialised Tools

l2pb2.zip
This is a later and faster version of l2pb. l2pb version 2 is a utility written in PBCC2 that creates a complete set of PowerBASIC include files from the Microsoft platformsdk libraries. It does all processing in memory and only has a single disk read and single disk write. The filtering is a lot more accurate and it uses a more compact form of declaration in the form

"ByVal LONG" for each parameter in the API calls.

For a declaration,

DECLARE FUNCTION MessageBox LIB "user32.dll" ALIAS "MessageBoxA"(ByVal LONG,ByVal LONG,ByVal LONG,ByVal LONG) as LONG

The API call is used as follows,

MessageBox hWnd,VarPtr(szMessage),VarPtr(szTitle),%MB_OK

file2asm.zip Version 2
File2asm convert a binary file into a complete working PowerBASIC function for imbedding binary files into code. Call this function in your code and you will have a string returned that is the exact size of the original binary file that can then be written to disk. Version 2 has had the code design changed slightly so that the start address of the DB sequence is determined at compile time using CodePtr() rather than at runtime using LEA. This is a bit more flexible in different corcumstances. It has an extra function on the edit menu for selecting and copying the complete function to the clipboard.

generic.zip is a commented working template for PowerBASIC programmers who have written software in DOS but run into the differences when programming in Windows. It assumes programming experience at low level in DOS basic compilers and it is aimed as a roadmap for basic programmers who are migrating to 32 bit windows.

Archival PBDLL Versions

Prostart  1.1
This is a port of the older version of Prostart.Exe into PBDLL60. It has had the code design changed to suit the later PB compiler and it delivers the same size code as the original version. It writes operating system based API style code with the option of adding a toolbar, status bar and an editable menu. It comes with an accessory to generate subclass functions for windows controls.

prostart.zip Version 1.0
PROSTART.EXE is a project starting code generator for the PBDLL50 compiler. It writes SDK style code for window applications rather than dialog box style applications. It is a code style suited to programmers who are familiar with API programming. It has name replacement options for function and other related code components, options for properties and optional status bar and toolbar code.

It is easy to set up and fires the FIRST time with standard PowerBASIC supplied files. It will generate at the minimum, a functional window at 8192 bytes. It comes with another utility for generating control subclass functions called SUBCLASS.EXEYou can compile the project directly from PROSTART.EXE, from a batch file "makepb.bat" or from the supplied IDE.

l2pb.exe
This is a specialised utility written in PBCC version 2. It is designed to create PowerBASIC compatible include files from the Microsoft import libraries included in the platformsdk. Run in a directory by itself it will produce an exhaustive set of function declarations in the form of one file for each Microsoft library, KERNEL32.INC, USER32.INC etc... The current size set of include files created this way is about 940k.
It auto generates the parameters in each function declaration as "ByVal p# as LONG" where p# is the number of the parameter.

The only problem in running them so far is that some API functions have the same name as PowerBASIC key words, SLEEP & BEEP and the API name need to be changed or deleted so that they will run properly.

Using a generic data type allows the programmer to approach function call parameters as either VALUES or ADDRESSES obtained by either VarPtr or StrPtr as in the following example,

DECLARE FUNCTION lstrlen LIB "KERNEL32.DLL" ALIAS "lstrlenA"(BYVAL p1 as LONG) as LONG
DECLARE FUNCTION lstrcat LIB "KERNEL32.DLL" ALIAS "lstrcatA"(BYVAL p1 as LONG,BYVAL p2 as LONG) as LONG

'#########################################################################

FUNCTION PbMain()

    LOCAL buffer1 as ASCIIZ * 128
    LOCAL buffer2 as ASCIIZ * 128
    LOCAL sl      as LONG

    buffer1 = "This is a test of the API lstrcat"+chr$(13,10)
    buffer2 = "and the API lstrlen. Str len => "

    lstrcat VarPtr(buffer1),VarPtr(Buffer2)
    sl = lstrlen(VarPtr(buffer1))

    StdOut buffer1 + str$(sl)

    FUNCTION = 0

END FUNCTION

' #########################################################################

Back to Home Page
 

 PowerBASIC Home Site USA