PowerBASIC Compiler for Windows

PowerBASIC for Windows is a native code compiler for all versions of Windows, from Windows 95 to Windows 10. It creates standard Windows GUI (Graphical User Interface) applications. It creates highly efficient executables and industry-standard DLLs for optimum flexibility. The machine code generated by PowerBASIC is among the most efficient in the industry, both in terms of size and speed. It compares most favorably with leading compilers of any dialect, Pascal, C++, Fortran, and others.


Create standard Windows GUI (Graphical User Interface) applications


The latest version of PB/Win sports a number of exciting new features. Total support for both ANSI and Unicode strings with automatic conversion. Simplified resource support. You can add resource data inline, right in your basic source code. There is no need to create a resource file, compile it, and then link it into your source. All this done automatically. Dead code removal. Unreferenced code will be removed from the compiled program to minimize the executable file size. Create client COM applications and COM components using Dispatch, Direct, Automation, or Dual interfaces. The inline assembler has been expanded to support the full range of SIMD opcodes. A complete graphics engine, a printer package for Windows-Only printers, dynamic pointers, and thread local storage, to name just a few. But more about them later.


Dynamic Dialog Tools
PowerBASIC DDT capabilities allows you to create a complete graphical user interface with ease, using just built-in statements and functions. DDT is perfect for many applications, as it gives you complete access to all of the standard controls like menus, buttons, listboxes, text boxes, labels, bitmaps, listviews, treeviews, and much more. You can specify custom colors, custom fonts, and custom styles, and best of all, your dialogs are truly dynamic! Controls can be modified, resized, moved, disabled, all under program control. Perhaps even more important, they're fast, fast, fast... loading as much as 20 times faster than Visual Basic forms.


Try our complete SMTP email client, a 30k executable with a graphical user interface, that allows you to send an email message to anyone on the internet. Some other compilers can't display "Hello" in a program 40 times that size! Of course, for more complex user interfaces, you might want to consider PowerBASIC Forms, our state-of-the-art Visual Dialog Designer.


PowerBASIC has long been associated with performance. Our motto has always been smaller-faster, smaller-faster, smaller-faster. In fact, it's been said more than once that PowerBASIC is the "Consultant's Secret Weapon".


So, how does it really stack up? In our comparisons, we've found that PowerBASIC can outperform Visual Basic by a factor from 3 to 23 times. That's correct, it's up to 2,300% faster than VB! Of course, PowerBASIC never requires any DLLs or run-times of any sort. So specifications on program size can be even more impressive. A "Hello, World!" program in VB is over 1,400,000 bytes with the necessary runtime code... but with PowerBASIC Compiler for Windows? Just 5,632 bytes on disk, or 2,615 bytes in memory. That's something like 23,000% smaller than Visual Basic!


So just how fast is PB/WIN anyway? We thought you'd never ask! This tiny example may give you some idea of the power in PowerBASIC.


  x## = 1
  y## = 1.000001
  t! = Timer
  For i& = 1 To 100000000    
     x## = x## * y##
t! = Timer - t!


What do we have here? 100,000,000 iterations of a simple floating point operation. On an AMD 64 CPU, PowerBASIC 3.5 for DOS runs this loop in 1.977 seconds. Pretty respectable, we think. PB3 has been benchmarked favorably against every sort of compiler... C++, Pascal, QuickBasic, you name it. It's always competitive.


So what about the PowerBASIC for Windows? Same computer. Same operating system (WinXP Pro). Same source code, line for line. No attempt to minimize any background tasks. Elapsed time: 0.209 seconds. May we repeat that? Elapsed time: 0.209 seconds. That's an instant gain of around 945%! Windows versions of PowerBASIC are more than nine times faster than the best DOS Basic around!


So why the big difference? A number of reasons... Attention to detail. Attention to results. A philosophy that requires us to provide the very best possible code generation. We simply don't believe that sloppy coding can always be overcome by ever faster hardware. At some point, every programmer (ours included!) must take on the obligation to write quality code... and we take that obligation very seriously.


Register Variables

Of course, performance is a factor of technical design issues, too. Like Register Variables. Normally, every time a variable is altered, assigned, or retrieved, memory must be accessed. That's a relatively slow process, as compared to accessing CPU and FPU registers. So PowerBASIC stores 4 float variables and 2 integer variables from each Sub/Function in a register instead of memory. Simple concept, but very effective. If those variables are referenced frequently, the improvement can be dramatic. Moreover, we let the programmer decide which variables should be register variables... that way, you can decide which will be most helpful.



So, how about graphics? Create a graphic control, open a graphic window, and you're ready to go! You'll use GRAPHIC PRINT to draw plain text or fancy text... Any font. Any size. Any color. Any escapement. Bold. Underline. Italic and strikeout. Mix any combination of fonts on any window. Print just about anything, just about anywhere, even on private bitmaps that aren't yet visible. You'll copy or stretch bitmaps. Shrink them or change them. Circles, ovals, lines and boxes. Fat lines, skinny lines, stylized lines. Arcs, circles, rounded rectangles. Ellipses, pie sections, polygons, polylines. Even get or set pixels -- one by one. Filled forms or empty. Colors or not. The choices are endless. You can mix new colors with those which exist, and measure proportional text size before you print it. Then create a custom scaling system, even with fractional floating point coordinates! Of course, once you've built that work of art, you need to load and save it: you'll load from a resource, load and save a BMP on disk! Create a virtual graphic control or window that displays the contents of a larger virtual window. Scroll bars are added so the user can move the viewport to the desired section. There is even an option to allow the user to "drag" the edges of a graphic window to a new size.


Another interesting point is that graphics are extensible. Using the DC (Device Context) from PowerBASIC, you can call the Windows API, your own custom code, even third-party code for special graphic functions. With GRAPHIC GET/SET BITS, you can even manipulate the bitmap directly... each pixel is stored in succession as a long integer color value.


And then there's printing. Access to printers has always been something of an issue, but not any more. First, we added the complete family of LPRINT functions, to give you direct text access to line printers. Then, we took it a step further with extended printing (XPRINT), even for "Windows-Only" printers! Just like GRAPHIC for the screen, XPRINT offers it all on the printer. Print plain text or fancy text -- any font, any size, any color. Bitmaps and images, lines and boxes, circles and polygons, virtually all the features of the GRAPHIC screen are there for printers, too! You can retrieve the size of the printer page, the printable area, the margins, even the number of points per inch. Select landscape or portrait mode, even the print quality setting. The PRINTER$() function returns the name and port of every available printer. You can attach a printer by its name, by default, or just display a printer dialog to let the user decide. It's all in there.


A complete Macro facility is provided. That's something seldom seen in a high level language. Essentially, a Macro invokes a text substitution engine which allows you to extend the PowerBASIC language in ways not seen before. PowerBASIC supports single line macros, multi-line macros, even function macros which return a result. And they don't occupy one byte of code space unless actually used. Each macro may take up to 240 arguments, so capacity shouldn't be an issue. MACROTEMP may even be used to specify identifiers which are made unique to each macro expansion, thus avoiding name conflicts. With PowerBASIC macros, you can design your own unique, personal language!


Unicode Support
Mix Unicode and ANSI in the same program. Convert strings to and from OEM, Unicode, ANSI, and UTF-8. Display Unicode characters. Print Unicode characters. Read and write to Unicode files. Conversions from Unicode and ANSI are automatic. You can even select to have a complete Unicode emulation package in your executable or DLL to allow them to run properly on Windows or select to have the runtime only use ANSI API routines.


Thread Safe Code
PowerBASIC is entirely thread-safe, so multi-threaded applications are a breeze. Isn't it good to know your program can handle 2, 3, or 5000 tasks, all at the same time? You can print a report, while still allowing data entry. Watch for a hardware signal, while calculating data services. All the power you need is packed right into the PowerBASIC Thread Statement, along with its simple extensions.


There is even a built-in THREAD object that offers a collection of methods which allow you to easily create and maintain additional threads of execution in your programs. Functions, Subroutines, Methods, and Properties can even be marked as THREADSAFE. When a procedure is declared THREADSAFE, PowerBASIC automatically establishes a semaphore which allows only one thread to execute it at a time. Others must wait until the first thread exits the THREADSAFE procedure before they are allowed to begin. This is important to protect global data (global, threaded, static, and instance variables) from corruption by interaction of the threads. PowerBASIC even offers THREADED variables for "Thread Local Storage" -- each THREAD get its own unique copy of the variable -- automatically.


Build COM Components
COM Components (Servers), create Dispatch, Direct, Dual, or Automation COM Components using easy to use built-in Basic like statements. Create classes with multiple interfaces, inheritance, constructors, destructors, private class methods, override inherited base classes, and much much more. Every object created or defined in PowerBASIC is fully compatible with the COM specification. Many popular compilers are not able to make that claim accurately. The COM specification defines a standardized method of communication between modules of code (frequently called components), regardless of the platform or the tool used to create them.


Client COM services, and support for the Dispatch, Direct, Automation, and Dual Interfaces lets you tap the power of components. Invoke libraries and applications with ease, all controlled from your PowerBASIC client program. You'll find that the PowerBASIC object implementation is very efficient, with virtually no degradation of execution speed as compared to standard Subs and Functions. Invoke an instance of Microsoft Word, load and edit documents, all under the control of PowerBASIC? It's all there now, waiting for your command...


Integrated Development Editor

The PowerBASIC IDE has had numerous major improvements. The IDE is now based on tabs rather than MDI children. Up to 36 bookmarks are now supported Improved undo handing. Quick context-sensitive syntax help is shown on the status bar. Find/Replace can now be set to wrap around the file. Project files have been enhanced to support a list of files, their scrolling position and caret position, a primary file, the active tab, breakpoints, bookmarks, and the debug Watch list. Backup files can now be created with a timestamp, numbered from 0 to 99, or even no backup file if you prefer. There's Print Preview and the new #PAGE metastatment for inserting a page break when printing from the IDE. Improved template files. The Open File dialog for source files now allows selecting multiple files at a time. And much more!


Debugging Tools

PowerBASIC shines with an array of built-in debugging functions. PROFILE gives an overview. A list of every sub and function, how many times each was called, and the total time spent executing each of them. CALLSTK captures all stack frames above you. It answers, "How did I get here?". TRACE generates an execution log of each sub, function, label, and TRACE PRINT, as they're executed in sequence. It gives you parameter values, return values, even error codes. TRACE answers "Where have I been?", and "How did I get here?". With these tools, debugging might now be fun!


Data Types
You know, a quality compiler must offer data types to suit the needs. And PowerBASIC handles that with ease. Signed and unsigned integers to 64-bit. Single, double, and extended precision float. Two forms of currency. Dynamic ANSI and Unicode strings, fixed ANSI and Unicode strings, Nul-Terminated ANSI and Unicode strings. User-defined Types and Unions. Guids. Variants, pointers, and more. BIT and SIGNED BIT variables in TYPES and UNIONS. Each may be from 1 to 31 bits wide, packed one after another. Perfect for bit coding, or translation from C code. And FIELD variables? They work with the new FIELD statement, just like in DOS versions of BASIC. A FIELD is a string, mapped to a specific section of a file buffer, or even another string. They're allocated at run-time, so they can be changed as needed. Much like a TYPE that can be altered under program control. There is even Unicode FIELD variables. Best of all, a new internal design makes them fast, fast, fast!


Pointers are great, but sometimes the syntax is daunting, particularly for very simple tasks. So we implemented Dynamic Pointers, using the original PEEK/POKE as a model: xx# = PEEK(DOUBLE,addr&) This retrieves the double precision value stored at addr&, assigning it to xx#. Very straightforward and it works for all data types. And unlike the old PEEK and POKE, it's just as fast as a pointer variable! Speaking of simplification, LOCAL, STATIC, GLOBAL, and RESET can now use a list of variables, like: STATIC abc, bcd, xyz AS STRING And, ARRAY ASSIGN lets you assign values to every element of an array in a single statement!


Even more ...

  • Inline Assembler supports opcodes through Pentium class, including MMX. SIMD, and floating point.
  • TCP and UDP functions allow you to download files from a web server, access an FTP site, send email over the internet, and even more
  • Regular Expression Search and Replace offer amazing scan capabilities. We have added Collections,
  • PowerCollection, LinkList, and Stack Collections. A Power Collection creates a set of data items, each of which is associated with an alpha-numeric key. A Linked List Collection is an ordered set of data items, which are accessed by their position in the list rather than by an alphanumeric key. A Stack Collection is an ordered set of data items, which are accessed on a LIFO (Last-In / First-Out) basis.
  • PowerARRAYs encapsulates the Windows SAFEARRAY structure. A PowerARRAY is perfect for sharing arrays between processes and COM Servers.
  • PowerTime object allows easy calculations on date and time values, such as comparing two dates


Bottom Line:
So simply put, one of our favorite slogans has been "We put the POWER in Basic..." We've said it before, but it's never been more true than it is today. With PowerBASIC version 10, there's a renewed War On Bloatware! You know, using PowerBASIC for Windows, it's not unusual to deliver a substantial GUI application on a single floppy diskette. Don't let the Power of PowerBASIC pass you by...


New Features in Version 10


Minimum System Requirements

  • Any version of Windows from Windows 95 through Windows 10
  • A hard disk with 30 Mb available space