.

PowerBASIC for Windows

 

Create your first PowerBASIC For Windows program. Learn how to write, compile, and execute code using the PowerBASIC For Windows IDE.


Build a complete 32-bit Windows program in 3 simple steps.

1. Press the down arrow on the toolbar button for New and select "Generic PB program" from the dropdown menu that is shown. A new document with a template skeleton code will be created, ready for insertion of some working code.

PBWin - New template

Some explanations for the template code: #COMPILE EXE tells the compiler to compile to an .exe program. #DIM ALL tells the compiler all variables must be declared with DIM, LOCAL, STATIC or GLOBAL before use. Declaring all variables before use saves the programmer from making simple mistakes like misspelling a variable name, which can result in some very-hard-to-find runtime errors. FUNCTION PBMAIN is the program's entry point and END FUNCTION is its exit point.



PBWin - Type in code

2. Type
MSGBOX "Hello world!" at the insertion point inside FUNCTION PBMAIN and save the document as for example Prog1.bas.



PBWin - Compile and Run

3. Compile and Execute (Run) the code.



And here's the result!

Hello world! A complete, stand-alone 32-bit Windows program, Prog1.exe, with a total size of only 5,632 bytes (as compiled using PBWin 8.01).

Jump to the top Return to index

. .