powerbasic compiler for windows version 8 compiler... · powerbasic compiler for windows version 8

749
Copyright © 1996-2019 by PowerBASIC Tools, LLC. All Rights Reserved. PowerBASIC Compiler for Windows Version 8

Upload: others

Post on 08-Oct-2019

66 views

Category:

Documents


2 download

TRANSCRIPT

  • Copyright © 1996-2019 by PowerBASIC Tools, LLC. All Rights Reserved.

    PowerBASIC Compiler forWindows Version 8

  • PowerBASIC Compiler for Windows Version 8

    2 / 749

    Table of contents

    Home ............................................................................................................. 25Introducing PowerBASIC For Windows 8 ............................................................ 25What is PowerBASIC For Windows? ................................................................... 27What can PowerBASIC For Windows do? ............................................................ 27What's New ..................................................................................................... 28

    New Statements and Functions ...................................................................... 28Changes to existing Statements and Functions ................................................. 32Additional Changes ...................................................................................... 35New in the IDE ............................................................................................ 37Previous Changes (PB/Win 7.0 release) .......................................................... 38

    User's Guide .................................................................................................... 46Running PB/Win .......................................................................................... 46

    Running PB/Win ...................................................................................... 46Running PB/Win From Windows ................................................................ 46Running PB/Win From DOS ....................................................................... 47PB/Win Command Line Switches ................................................................ 47

    Writing Programs in PB/Win .......................................................................... 48Line numbers and Labels .......................................................................... 48Long lines ............................................................................................... 49Statement separation ................................................................................ 50Structured Programming .......................................................................... 50Variables ................................................................................................. 51

    The PowerBASIC Integrated Development Environment ................................... 52The PowerBASIC Integrated Development Environment ............................... 52The PowerBASIC User Interface ................................................................ 53Toolbar Buttons ....................................................................................... 54Editor Hot Keys ........................................................................................ 54IDE Context Menu .................................................................................... 56File Templates ......................................................................................... 57Custom Help Files .................................................................................... 58IDE Dialogs ............................................................................................. 59

    Code Finder Dialog .............................................................................. 59Command Line Dialog .......................................................................... 59Debugger Evaluate Dialog ..................................................................... 59Find Dialog ......................................................................................... 59Go to Line Dialog ................................................................................. 60Primary Source File Dialog .................................................................... 60Replace Dialog Box .............................................................................. 61

    IDE Options ............................................................................................ 61IDE Options ........................................................................................ 61Browsing for Include folders ................................................................. 62Compiler Preferences ........................................................................... 63Editor Preferences ................................................................................ 64

  • PowerBASIC Compiler for Windows Version 8

    3 / 749

    Editor Text Preferences ......................................................................... 66File Preferences ................................................................................... 66General Preferences ............................................................................. 68Printer Preferences ............................................................................... 69Syntax Color Preferences ...................................................................... 69Syntax Color Selector ........................................................................... 71Syntax Custom Color Selector ............................................................... 71

    Creating Dynamic Link Libraries ..................................................................... 72What is a Dll? .......................................................................................... 72Why use Dlls? .......................................................................................... 73Creating a Dynamic Link Library ................................................................ 73Private and Exported Procedures ............................................................... 74Dll example ............................................................................................. 75LibMain ................................................................................................... 76

    Debugging PB/Win Programs ........................................................................ 76Debugging PB/Win Programs .................................................................... 76How the integrated debugger works ........................................................... 77The Debug Menu ..................................................................................... 77Debugging a simple program .................................................................... 79

    Debugging a simple program ................................................................ 79TWORD.bas Source Listing ................................................................... 80Setting and using breakpoints ............................................................... 82Tracing execution ................................................................................ 83Evaluating a variable ............................................................................ 83Summary ............................................................................................ 84

    The PowerBASIC COM Browser ..................................................................... 84The PowerBASIC COM Browser ................................................................. 84The PowerBASIC COM Browser user interface ............................................. 85Opening a type-library .............................................................................. 87Exporting an Interface Structure ................................................................ 87Additional Notes ...................................................................................... 89The PowerBASIC COM Browser Tutorial ..................................................... 89Early Binding Tutorial ............................................................................... 90Late Binding Tutorial ................................................................................ 91

    Programming Reference ................................................................................... 94Programming Reference ............................................................................... 94Data Types .................................................................................................. 95

    Data Handling ......................................................................................... 95Integer Data Types .................................................................................. 96

    Byte (?) .............................................................................................. 96Word (??) ........................................................................................... 96Integers (%) ....................................................................................... 97Double-word (???) ............................................................................... 97Long integers (&) ................................................................................. 98Quad integers (&&) .............................................................................. 99

  • PowerBASIC Compiler for Windows Version 8

    4 / 749

    Floating Point Data Types ......................................................................... 99Single-precision floating-point (!) ........................................................... 99Double-precision floating-point (#) ...................................................... 100Extended-precision floating-point (##) ................................................. 100Currency (@) and Extended-currency (@@) .......................................... 101

    String Data Types .................................................................................. 102ASCIIZ strings ................................................................................... 102Dynamic (Variable-length) strings ($) ................................................... 103FIELD strings ..................................................................................... 104Fixed-length strings ............................................................................ 105String expressions .............................................................................. 106String Operations Commands .............................................................. 107

    Array Data Types ................................................................................... 109Array Data Types ............................................................................... 109Subscripts ......................................................................................... 110String arrays ...................................................................................... 111Multidimensional arrays ...................................................................... 112Array storage requirements ................................................................. 112Internal representations of arrays ......................................................... 113Arrays within User-Defined Types ........................................................ 113Array operations ................................................................................ 114

    User-Defined Types and Unions ............................................................... 115User-Defined Types (UDTs) ................................................................. 115Defining User-Defined Types ............................................................... 116Accessing the fields of a User-Defined Type .......................................... 116Nesting User-Defined Types ................................................................ 117Arrays within User-Defined Types ........................................................ 118Using arrays of User-Defined Types ..................................................... 119Using User-Defined Types with procedures and functions ....................... 119Storage requirements and restrictions ................................................... 121Unions .............................................................................................. 121

    Unions .......................................................................................... 121Storage requirements and restrictions ............................................... 122

    Pointer Data Types ................................................................................. 122Pointers (@) ...................................................................................... 122Pointers to ASCIIZ and fixed-length strings ........................................... 126Pointers to arrays ............................................................................... 126Pointers to arrays with dual indexes ..................................................... 128

    Constants .............................................................................................. 129Constants and Literals ......................................................................... 129Defining Constants ............................................................................. 129Numeric Equates ................................................................................ 130Built-in numeric equates ..................................................................... 132String Equates ................................................................................... 133Built-in string equates ......................................................................... 134

  • PowerBASIC Compiler for Windows Version 8

    5 / 749

    Bit Data Types ....................................................................................... 134GUID data types .................................................................................... 135Object Data Type ................................................................................... 135Variant Data Types ................................................................................. 136Comarative Data Types ........................................................................... 138

    C/C++ .............................................................................................. 138Delphi ............................................................................................... 140Visual Basic 6 .................................................................................... 141

    Variables and Variable Scope ....................................................................... 141Variables ............................................................................................... 141Default Variable Typing .......................................................................... 142THREADED variables .............................................................................. 142Variable scope ....................................................................................... 143LOCAL, GLOBAL and STATIC considerations ............................................ 144

    Operators .................................................................................................. 146Arithmetic Operators .............................................................................. 146Relational Operators ............................................................................... 146Operator Precedence .............................................................................. 148

    Files ......................................................................................................... 148Files ..................................................................................................... 148Sequential Files ...................................................................................... 149Random Access Files .............................................................................. 150Binary Files ............................................................................................ 152

    Errors and Error Trapping ........................................................................... 152Errors ................................................................................................... 152Numeric Errors ...................................................................................... 153Error range ........................................................................................... 153User-defined Errors ................................................................................ 154Error Trapping ....................................................................................... 154

    Error Trapping ................................................................................... 154How error traps work ......................................................................... 155Setting an error trap ........................................................................... 156Writing an error handler ..................................................................... 156Exiting an error handler ...................................................................... 156Error Trapping Summary .................................................................... 157

    Compile Time Errors .............................................................................. 158Compile-time errors ........................................................................... 158Error 401 Expression too long/complex ................................................ 158Error 402 - Statement too long/complex ............................................... 159Error 403 - #IF nesting overflow ......................................................... 159Error 404 - #INCLUDE file/Macro nesting overflow ................................ 159Error 405 - Block nesting overflow ....................................................... 159Error 406 - Compiler out of memory .................................................... 159Error 407 - Source line too long .......................................................... 160Error 408 - Wrong compiler for this program ........................................ 160

  • PowerBASIC Compiler for Windows Version 8

    6 / 749

    Error 409 - Sub/Function is too large ................................................... 160Error 411 - "," expected ...................................................................... 160Error 412 - ";" expected ...................................................................... 160Error 413 - "(" expected ...................................................................... 160Error 414 - ")" expected ...................................................................... 161Error 415 - "=" expected ..................................................................... 161Error 416 - "-" expected ...................................................................... 161Error 417 - "*" expected ..................................................................... 161Error 418 - Statement expected ........................................................... 161Error 419 - Label/line number expected ................................................ 161Error 420 - Relational operator expected ............................................... 161Error 421 - String operand expected .................................................... 162Error 422 - Scalar variable expected ..................................................... 162Error 423 - Array variable expected ...................................................... 162Error 424 - Numeric variable expected .................................................. 162Error 425 - String variable expected ..................................................... 162Error 426 - Variable expected .............................................................. 162Error 427 - Integer constant expected .................................................. 162Error 428 - Positive integer constant expected ....................................... 163Error 429 - String constant expected .................................................... 163Error 430 - Integer variable expected ................................................... 163Error 431 - Numeric scalar variable expected ......................................... 163Error 432 - Long-integer variable expected ........................................... 163Error 433 - Matrix array expected (integer/float) .................................... 164Error 434 - End of line expected .......................................................... 164Error 435 - #IF expected .................................................................... 164Error 436 - #ENDIF expected .............................................................. 164Error 437 - AS expected ..................................................................... 164Error 438 - Member name expected ..................................................... 164Error 439 - GOSUB expected ............................................................... 164Error 440 - GOTO expected ................................................................ 165Error 441 - IN expected ...................................................................... 165Error 442 - THEN expected ................................................................. 165Error 443 - TO expected ..................................................................... 165Error 444 - WITH expected ................................................................. 165Error 445 - OF expected ..................................................................... 165Error 446 - FUNCTION expected .......................................................... 165Error 447 - IF expected ....................................................................... 166Error 448 - DO loop expected .............................................................. 166Error 449 - SELECT expected .............................................................. 166Error 450 - CASE expected .................................................................. 166Error 451 - FOR loop expected ............................................................ 166Error 452 - SUB expected .................................................................... 166Error 453 - Equate (%xyz) expected ..................................................... 167Error 454 - END FUNCTION expected .................................................. 167

  • PowerBASIC Compiler for Windows Version 8

    7 / 749

    Error 455 - END IF expected ............................................................... 167Error 456 - LOOP/WEND expected ....................................................... 167Error 457 - END SELECT expected ....................................................... 167Error 458 - END SUB expected ............................................................ 167Error 459 - NEXT expected .................................................................. 167Error 460 - Undefined equate .............................................................. 168Error 461 - Array not dimensioned ...................................................... 168Error 462 - Undefined SUB/FUNCTION reference ................................... 168Error 463 - Undefined label/line reference ............................................. 168Error 465 - Duplicate definition ............................................................ 168Error 466 - Duplicate name definition ................................................... 168Error 467 - Duplicate line number ........................................................ 169Error 468 - Duplicate equate ............................................................... 169Error 471 - Invalid line number ........................................................... 169Error 472 - Invalid label ...................................................................... 170Error 473 - Invalid numeric format ...................................................... 170Error 474 - Invalid name .................................................................... 170Error 475 - Metastatements not allowed here ........................................ 170Error 476 - Block/scanned statements not allowed here .......................... 170Error 477 - Syntax error ..................................................................... 170Error 478 - Resource file error ............................................................. 171Error 479 - Array bounds error ............................................................ 171Error 480 - Parameter mismatches definition ......................................... 171Error 481 - Mismatch with prior definition ............................................. 171Error 482 - Data type mismatch ........................................................... 172Error 484 - Requires procedure (Sub/Function) ..................................... 172Error 485 - Dynamic/Field strings not allowed ....................................... 172Error 486 - BYVAL option not allowed .................................................. 172Error 487 - Name Declaration Error ...................................................... 172Error 488 - Numeric processor overflow ............................................... 173Error 489 - Invalid string length .......................................................... 173Error 490 - Static array too large ......................................................... 173Error 491 - Invalid register variable ...................................................... 173Error 493 - Compiler file not found/accessible ....................................... 173Error 494 - ASM not allowed here ........................................................ 173Error 495 - Compiler file read error ...................................................... 174Error 496 - Destination file write error .................................................. 174Error 497 - Assembler syntax error ...................................................... 174Error 498 - Assembler variables must be declared ................................. 174Error 499 - Statement must be first on line ........................................... 174Error 500 - 32-bit operating system error ............................................. 174Error 501 - Parameters too large (exceed 64 Kb) ................................... 175Error 503 - Multiple Main Functions have been defined ........................... 175Error 504 - Executable requires PBMAIN/WINMAIN function ................... 175Error 505 - Debugging requires EXE file, not DLL .................................. 175

  • PowerBASIC Compiler for Windows Version 8

    8 / 749

    Error 506 - Declaration must precede statements ................................... 175Error 510 - Interface name expected .................................................... 176Error 511 - Numeric operand expected ................................................. 176Error 512 - Nested brackets not allowed ............................................... 176Error 513 - "]" expected ...................................................................... 176Error 514 - Enclosing angle brackets expected .............................. 176Error 515 - Fixup overflow .................................................................. 176Error 516 - DEFtype, Type ID or type-specifier required ......................... 176Error 517 - OPTIONAL requires CDECL or SDECL .................................. 177Error 518 - "[...]" requires CDECL ........................................................ 177Error 519 - Missing declaration ............................................................ 177Error 520 - TYPE expected .................................................................. 177Error 521 - UNION expected ............................................................... 177Error 522 - END TYPE expected ........................................................... 177Error 523 - END UNION expected ........................................................ 178Error 524 - Undefined type ................................................................. 178Error 525 - Type ID or specifier (?%&!#$) not allowed .......................... 178Error 526 - Period not allowed ............................................................ 178Error 527 - End of statement expected ................................................. 178Error 528 - Type too large .................................................................. 178Error 529 - Pointer variable error ......................................................... 179Error 530 - Invalid member name/definition ......................................... 179Error 531 - Object variable expected .................................................... 179Error 532 - Variant variable expected ................................................... 179Error 533 - Dispatch object variable expected ........................................ 179Error 534 - Bit field error .................................................................... 180Error 535 - Dynamic string variable expected ........................................ 180Error 536 - Too many imports ............................................................. 180Error 537 - Pointer expected ............................................................... 180Error 538 - Invalid FOR/NEXT limits ..................................................... 180Error 539 - Invalid thread function ....................................................... 180Error 540 - Float opcode with a register variable .................................... 181Error 541 - Register size conflict .......................................................... 181Error 542 - May not be altered ............................................................. 181Error 543 - Must be outside Sub/Function ............................................. 182Error 544 - Field variable expected ....................................................... 182Error 545 - AT expected ..................................................................... 182Error 546 - Use only as a Callback ....................................................... 182Error 547 - Callback function required .................................................. 182Error 548 - No parameters with Callback .............................................. 182Error 549 - BYVAL required with pointers ............................................. 183Error 550 - Too many data statements ................................................. 183Error 551 - Not supported in this version .............................................. 183Error 552 - TRY statement expected ..................................................... 183Error 553 - CATCH statement expected ................................................ 183

  • PowerBASIC Compiler for Windows Version 8

    9 / 749

    Error 554 - END TRY statement expected ............................................. 183Error 555 - ON ERROR/RESUME not allowed here ................................. 184Error 556 - Function restricted to threads .............................................. 184Error 557 - Macro too long/complex ..................................................... 184Error 558 - MACRO expected .............................................................. 184Error 559 - END MACRO expected ....................................................... 185Error 562 - INTERFACE expected ......................................................... 185Error 563 - END INTERFACE expected ................................................. 185Error 564 - MACROTEMP not allowed here ........................................... 185Error 565 - Macro mismatch with code position ..................................... 185Error 601 to 615 - Internal error .......................................................... 185

    Run Time Errors .................................................................................... 185Run-time errors ................................................................................. 185Disk Errors ........................................................................................ 186Error 0 - No error .............................................................................. 187Error 5 - Illegal function call ................................................................ 187Error 6 - Overflow .............................................................................. 188Error 7 - Out of memory ..................................................................... 188Error 9 - Subscript / Pointer out of range .............................................. 188Error 11 - Division by zero .................................................................. 188Error 24 - Device time-out .................................................................. 188Error 51 - Internal error ...................................................................... 188Error 52 - Bad file name or number ..................................................... 189Error 53 - File not found ..................................................................... 189Error 54 - Bad file mode ..................................................................... 189Error 55 - File is already open ............................................................. 189Error 57 - Device I/O error .................................................................. 189Error 58 - File already exists ................................................................ 190Error 61 - Disk full ............................................................................. 190Error 62 - Input past end .................................................................... 190Error 63 - Bad record number ............................................................. 190Error 64 - Bad file name ..................................................................... 190Error 67 - Too many files .................................................................... 190Error 68 - Device unavailable ............................................................... 191Error 69 - COMM error ....................................................................... 191Error 70 - Permission denied ............................................................... 191Error 71 - Disk not ready .................................................................... 191Error 72 - Disk media error ................................................................. 191Error 74 - Rename across disks ........................................................... 191Error 75 - Path/file access error ........................................................... 192Error 76 - Path not found .................................................................... 192Error 99 - Object error ....................................................................... 192Error 241 - Global memory corrupt ...................................................... 192Error 242 - String space corrupt .......................................................... 192

    Dynamic Dialog Tools (DDT) ....................................................................... 192

  • PowerBASIC Compiler for Windows Version 8

    10 / 749

    Dynamic Dialog Tools (DDT) ................................................................... 192Creating a Dialog ................................................................................... 193Adding Controls to the Dialog ................................................................. 194Modal vs. Modeless ................................................................................ 197Controls ................................................................................................ 198Control Styles ........................................................................................ 200Callbacks ............................................................................................... 201Dialog Styles ......................................................................................... 204Menus ................................................................................................... 205Menu Walkthrough ................................................................................. 206More on the Menu .................................................................................. 207Menu State ............................................................................................ 208Menu Example ....................................................................................... 209

    Graphics ................................................................................................... 211Printing ..................................................................................................... 212Resource Files ............................................................................................ 213

    What is a Resource File? ......................................................................... 213Resource Editors .................................................................................... 214Resource File Compiling .......................................................................... 214Resource Scripts .................................................................................... 215Dialog Resources ................................................................................... 216Converting a .DLG to a .RC ................................................................... 217Converting a .RC to a .RES ...................................................................... 217Converting a .RES to a .PBR .................................................................... 218

    Serial Communications ............................................................................... 218Serial Communications ........................................................................... 218Communications Basics ........................................................................... 220Communication Buffers ........................................................................... 221Parity and general error checking ............................................................. 222Start and stop bits .................................................................................. 222Opening a communications port .............................................................. 223Reading and writing data ........................................................................ 225A simple communications program .......................................................... 226

    TCP and UDP Communications .................................................................... 235TCP and UDP Communications ................................................................ 235The Internet Protocol (IP) ....................................................................... 235User Datagram Protocol (UDP) ................................................................ 236Transmission Control Protocol (TCP) ........................................................ 237Winsock ................................................................................................ 237Request for Comments (RFC) .................................................................. 238TCP clients and servers ........................................................................... 238Simple Mail Transfer Protocol (SMTP) ....................................................... 239An ECHO client and server using TCP ....................................................... 241

    The Inline Assembler ................................................................................. 243The Inline Assembler ............................................................................. 243

  • PowerBASIC Compiler for Windows Version 8

    11 / 749

    Using assembly-language in your code ..................................................... 244Inline Assembler code syntax .................................................................. 245Flat memory model ................................................................................ 245Protected mode programming ................................................................. 246Mnemonics and Operands ....................................................................... 247Opcodes and Mnemonics ........................................................................ 248Registers ............................................................................................... 248Data types in Registers ........................................................................... 250MMX registers ........................................................................................ 251The Stack .............................................................................................. 251Balancing the stack ................................................................................. 252Tricks of the stack .................................................................................. 253Stack Overhead Reduction ....................................................................... 253Saving registers ..................................................................................... 254Saving Registers at the Sub/Function level ................................................ 255Intermixing ASM and BASIC code ............................................................ 256Using ESP and EBP ................................................................................. 258Local variables ....................................................................................... 258Saving the FPU registers ......................................................................... 259Tricks in preserving registers ................................................................... 259Addressing and pointers ......................................................................... 260Effective Addressing ............................................................................... 261Passing parameters ................................................................................ 263Parameters passed by reference or by copy ............................................... 263Parameters passed by value .................................................................... 264Passing arrays ....................................................................................... 264Passing dynamic strings .......................................................................... 265Accessing PowerBASIC variables by name ................................................ 266Commenting Assembly code ................................................................... 266

    COM Programming .................................................................................... 266COM Programming Introduction .............................................................. 267COM is an acronym? .............................................................................. 267Ok, but what actually is COM? ................................................................. 268What is a COM component? .................................................................... 268COM servers and COM clients .................................................................. 269What is a Dispatch Interface? ................................................................... 269Is there a Method to the madness? ........................................................... 270COM initialization ................................................................................... 270Early-binding and Late-binding ................................................................ 271Creating an Instance of an Object ............................................................ 271Creating an early-bound object variable .................................................... 272Creating a late-bound object variable ....................................................... 272How does the LET statement work? ......................................................... 273New or pre-loaded? ................................................................................ 273Under the hood ..................................................................................... 274

  • PowerBASIC Compiler for Windows Version 8

    12 / 749

    Methods and Properties .......................................................................... 275Parameters ............................................................................................ 277Positional and Named parameter passing .................................................. 278Return data ........................................................................................... 279Enumerating collections .......................................................................... 280Converting COM code to PowerBASIC ...................................................... 281Example COM controller application ......................................................... 282COM Programming Summary .................................................................. 285

    Working with Visual Basic ........................................................................... 285Visual Basic Data Types .......................................................................... 285ActiveX, OCX and COM Libraries .............................................................. 286VB Run-time errors when calling a PowerBASIC DLL .................................. 286

    Optimizing your code ................................................................................. 287Keyword Reference ......................................................................................... 289

    Keyword Quick Finder ................................................................................. 289Keyword Reference ..................................................................................... 304Format and typefaces ................................................................................. 305Command Summary .................................................................................. 306

    Command Summary .............................................................................. 306Array Operations ................................................................................... 306COM Commands .................................................................................... 307Communication Control .......................................................................... 308Compiler Operations .............................................................................. 308Debugging and Error Control .................................................................. 309Dynamic Dialog Tools ............................................................................. 310File Commands ...................................................................................... 313Flow Control .......................................................................................... 314Graphic Commands ................................................................................ 315Input Commands ................................................................................... 316Memory Management ............................................................................. 316Metastatements ...................................................................................... 316Numeric Operations ............................................................................... 317Operating System .................................................................................. 319Printing Commands ................................................................................ 320String Operations ................................................................................... 322Thread Control ...................................................................................... 324Time Commands ................................................................................... 324Misc Operations ..................................................................................... 325

    %DEF operator .......................................................................................... 325#BLOAT metastatement ............................................................................. 326#COMPILE metastatement .......................................................................... 326#COMPILER metastatement ........................................................................ 327#DEBUG ERROR metastatement .................................................................. 327#DEBUG PRINT metastatement ................................................................... 328#DIM metastatement .................................................................................. 328

  • PowerBASIC Compiler for Windows Version 8

    13 / 749

    #IF metastatement ..................................................................................... 329#INCLUDE metastatement .......................................................................... 331#OPTION metastatement ........................................................................... 331#PBFORMS metastatement .......................................................................... 332#REGISTER metastatement ......................................................................... 332#RESOURCE metastatement ....................................................................... 333#STACK metastatement .............................................................................. 334#TOOLS metastatement ............................................................................. 334ABS function ............................................................................................. 334ACCEL ATTACH statement .......................................................................... 334ACODE$ function ....................................................................................... 336AND operator ............................................................................................ 337ARRAY ASSIGN statement .......................................................................... 337ARRAY DELETE statement .......................................................................... 338ARRAY INSERT statement .......................................................................... 339ARRAY SCAN statement ............................................................................. 340ARRAY SORT statement ............................................................................. 343ARRAYATTR function ................................................................................. 346ASC function ............................................................................................. 348ASC statement ........................................................................................... 348ASM statement .......................................................................................... 349ATN function ............................................................................................. 351BEEP statement .......................................................................................... 352BGR function ............................................................................................. 352BIN$ function ............................................................................................ 353BIT CALC statement ................................................................................... 353BIT function .............................................................................................. 354BIT statement ............................................................................................ 355BITS function ............................................................................................ 356BITS functions ........................................................................................... 357CALL statement ......................................................................................... 357CALL DWORD statement ............................................................................. 359CALLSTK statement .................................................................................... 362CALLSTK$ function .................................................................................... 363CALLSTKCOUNT function ........................................................................... 363CBCTL function .......................................................................................... 364CBCTLMSG function ................................................................................... 364CBHNDL function ....................................................................................... 365CBLPARAM function ................................................................................... 366CBMSG function ......................................................................................... 366CBWPARAM function .................................................................................. 367CBYT function ........................................................................................... 367CCUR function ........................................................................................... 368CCUX function ........................................................................................... 369CDBL function ............................................................................................ 370

  • PowerBASIC Compiler for Windows Version 8

    14 / 749

    CDWD function .......................................................................................... 372CEIL function ............................................................................................. 373CEXT function ............................................................................................ 373CHDIR statement ....................................................................................... 374CHDRIVE statement ................................................................................... 375CHOOSE function ....................................................................................... 375CHR$ function ........................................................................................... 376CINT function ............................................................................................ 376CLNG function ........................................................................................... 377CLOSE statement ....................................................................................... 378CLSID$ function ......................................................................................... 379CODEPTR function ..................................................................................... 380COMBOBOX ADD statement ........................................................................ 380COMBOBOX DELETE statement .................................................................... 380COMBOBOX GET TEXT statement ................................................................ 381COMBOBOX RESET statement ..................................................................... 381COMBOBOX SELECT statement .................................................................... 382COMM CLOSE statement ............................................................................. 382COMM function .......................................................................................... 382COMM LINE statement ................................................................................ 384COMM OPEN statement .............................................................................. 385COMM PRINT statement ............................................................................. 386COMM RECV statement ............................................................................... 386COMM RESET statement ............................................................................. 387COMM SEND statement ............................................................................... 387COMM SET statement ................................................................................. 387COMMAND$ function .................................................................................. 390CONTROL ADD statement ........................................................................... 390CONTROL ADD BUTTON statement ............................................................. 391CONTROL ADD CHECK3STATE statement .................................................... 394CONTROL ADD CHECKBOX statement .......................................................... 397CONTROL ADD COMBOBOX statement ......................................................... 399CONTROL ADD FRAME statement ................................................................ 403CONTROL ADD GRAPHIC statement ............................................................ 405CONTROL ADD IMAGE statement ................................................................ 406CONTROL ADD IMAGEX statement .............................................................. 408CONTROL ADD IMGBUTTON statement ....................................................... 410CONTROL ADD IMGBUTTONX statement ..................................................... 413CONTROL ADD LABEL statement ................................................................. 415CONTROL ADD LINE statement ................................................................... 418CONTROL ADD LISTBOX statement ............................................................. 420CONTROL ADD OPTION statement .............................................................. 423CONTROL ADD SCROLLBAR statement ........................................................ 426CONTROL ADD TEXTBOX statement ............................................................ 428CONTROL DISABLE statement ..................................................................... 432

  • PowerBASIC Compiler for Windows Version 8

    15 / 749

    CONTROL ENABLE statement ...................................................................... 432CONTROL GET CHECK statement ................................................................ 432CONTROL GET CLIENT statement ............................................................... 433CONTROL GET LOC statement .................................................................... 433CONTROL GET SIZE statement .................................................................... 433CONTROL GET TEXT statement ................................................................... 434CONTROL GET USER statement .................................................................. 434CONTROL HANDLE statement ..................................................................... 435CONTROL KILL statement ........................................................................... 435CONTROL POST statement ......................................................................... 435CONTROL REDRAW statement .................................................................... 436CONTROL SEND statement ......................................................................... 437CONTROL SET CHECK statement ................................................................. 438CONTROL SET CLIENT statement ................................................................ 438CONTROL SET COLOR statement ................................................................ 438CONTROL SET FOCUS statement ................................................................. 440CONTROL SET IMAGE statement ................................................................. 441CONTROL SET IMAGEX statement ............................................................... 441CONTROL SET IMGBUTTON statement ........................................................ 442CONTROL SET IMGBUTTONX statement ...................................................... 442CONTROL SET LOC statement ..................................................................... 443CONTROL SET OPTION statement ............................................................... 443CONTROL SET SIZE statement .................................................................... 444CONTROL SET TEXT statement ................................................................... 444CONTROL SET USER statement ................................................................... 445CONTROL SHOW STATE statement ............................................................. 445COS function ............................................................................................. 446CQUD function .......................................................................................... 447CSET statement ......................................................................................... 448CSET$ function .......................................................................................... 448CSNG function ........................................................................................... 449CURDIR$ function ...................................................................................... 450CVBYT function ......................................................................................... 450CVCUR function ......................................................................................... 451CVCUX function ......................................................................................... 452CVD function ............................................................................................. 453CVDWD function ........................................................................................ 454CVE function ............................................................................................. 455CVI function .............................................................................................. 456CVL function .............................................................................................. 457CVQ function ............................................................................................. 458CVS function ............................................................................................. 459CVWRD function ........................................................................................ 460CWRD function .......................................................................................... 461DATA statement ........................................................................................ 462

  • PowerBASIC Compiler for Windows Version 8

    16 / 749

    DATACOUNT function ................................................................................ 463DATE$ system variable ............................................................................... 463DECLARE statement ................................................................................... 464DECR statement ......................................................................................... 467DEFBYT statement ..................................................................................... 468DEFCUR statement ..................................................................................... 468DEFCUX statement ..................................................................................... 469DEFDBL statement ...................................................................................... 470DEFDWD statement .................................................................................... 471DEFEXT statement ...................................................................................... 472DEFINT statement ...................................................................................... 472DEFLNG statement ..................................................................................... 473DEFQUD statement .................................................................................... 474DEFSNG statement ..................................................................................... 475DEFSTR statement ..................................................................................... 476DEFWRD statement .................................................................................... 476DESKTOP GET CLIENT statement ................................................................ 477DESKTOP GET LOC statement ..................................................................... 477DESKTOP GET SIZE statement .................................................................... 478DIALOG DISABLE statement ....................................................................... 478DIALOG DOEVENTS statement .................................................................... 478DIALOG ENABLE statement ......................................................................... 479DIALOG END statement .............................................................................. 479DIALOG FONT statement ............................................................................ 480DIALOG GET CLIENT statement .................................................................. 481DIALOG GET LOC statetement .................................................................... 481DIALOG GET SIZE statement ...................................................................... 481DIALOG GET TEXT statement ..................................................................... 482DIALOG GET USER statement ..................................................................... 482DIALOG NEW statement ............................................................................. 482DIALOG PIXELS statement .......................................................................... 487DIALOG POST statement ............................................................................ 487DIALOG REDRAW statement ....................................................................... 488DIALOG SEND statement ............................................................................ 489DIALOG SET CLIENT Statement .................................................................. 489DIALOG SET COLOR statement ................................................................... 490DIALOG SET ICON statement ...................................................................... 491DIALOG SET LOC statement ....................................................................... 491DIALOG SET SIZE statement ....................................................................... 492DIALOG SET TEXT statement ...................................................................... 492DIALOG SET USER statement ...................................................................... 492DIALOG SHOW MODAL statement ............................................................... 493DIALOG SHOW MODELESS statement .......................................................... 494DIALOG SHOW STATE statement ................................................................ 494DIALOG UNITS statement ........................................................................... 495

  • PowerBASIC Compiler for Windows Version 8

    17 / 749

    DIM statement ........................................................................................... 495DIR$ function ............................................................................................ 499DIR$ CLOSE statement ............................................................................... 501DISKFREE function ..................................................................................... 501DISKSIZE function ...................................................................................... 501DLLMAIN function ...................................................................................... 502DO/LOOP statements ................................................................................. 504ENVIRON statement ................................................................................... 506ENVIRON$ function .................................................................................... 506EOF function ............................................................................................. 507EQV operator ............................................................................................ 507ERASE statement ....................................................................................... 508ERL system variable ................................................................................... 509ERR system variable ................................................................................... 509ERRCLEAR system variable ......................................................................... 510ERROR statement ....................................................................................... 511ERROR$ function ....................................................................................... 511EXIT statement .......................................................................................... 511EXP function .............................................................................................. 513EXP2 function ............................................................................................ 513EXP10 function .......................................................................................... 514EXTRACT$ function .................................................................................... 514FIELD statement ........................................................................................ 515FILEATTR function ..................................................................................... 516FILECOPY statement .................................................................................. 517FILENAME$ function ................................................................................... 517FILESCAN statement .................................................................................. 518FIX function ............................................................................................... 518FLUSH statement ....................................................................................... 518FOR/NEXT statements ................................................................................ 519FORMAT$ function ..................................................................................... 521FRAC function ........................................................................................... 524FREEFILE function ...................................................................................... 525FUNCNAME$ function ................................................................................. 525FUNCTION/END FUNCTION statements ....................................................... 526GET statement ........................................................................................... 530GET$ statement ......................................................................................... 532GETATTR function ..................................................................................... 533GLOBAL statement ..................................................................................... 534GOSUB statement ...................................................................................... 535GOSUB DWORD statement .......................................................................... 535GOTO statement ........................................................................................ 536GOTO DWORD statement ........................................................................... 537GRAPHIC ARC statement ............................................................................ 538GRAPHIC ATTACH statement ...................................................................... 538

  • PowerBASIC Compiler for Windows Version 8

    18 / 749

    GRAPHIC BITMAP END statement ................................................................ 539GRAPHIC BITMAP LOAD statement ............................................................. 539GRAPHIC BITMAP NEW statement ............................................................... 540GRAPHIC BOX statement ............................................................................ 540GRAPHIC CHR SIZE statement .................................................................... 541GRAPHIC CLEAR statement ......................................................................... 541GRAPHIC COLOR statement ........................................................................ 542GRAPHIC COPY statement .......................................................................... 542GRAPHIC ELLIPSE statement ....................................................................... 543GRAPHIC FONT statement .......................................................................... 544GRAPHIC GET BITS statement .................................................................... 544GRAPHIC GET CLIENT statement ................................................................ 545GRAPHIC GET DC statement ....................................................................... 545GRAPHIC GET LOC statement ..................................................................... 545GRAPHIC GET MIX statement ...................................................................... 546GRAPHIC GET PIXEL statement ................................................................... 546GRAPHIC GET POS statement ..................................................................... 546GRAPHIC GET PPI statement ...................................................................... 547GRAPHIC LINE statement ........................................................................... 547GRAPHIC PAINT statement ......................................................................... 548GRAPHIC PIE statement ............................................................................. 549GRAPHIC POLYGON statement .................................................................... 550GRAPHIC POLYLINE statement .................................................................... 551GRAPHIC PRINT statement ......................................................................... 552GRAPHIC REDRAW statement ..................................................................... 553GRAPHIC RENDER statement ...................................................................... 553GRAPHIC SAVE statement .......................................................................... 553GRAPHIC SCALE statement ......................................................................... 554GRAPHIC SET BITS statement ..................................................................... 554GRAPHIC SET FOCUS statement .................................................................. 555GRAPHIC SET LOC statement ...................................................................... 555GRAPHIC SET MIX statement ...................................................................... 555GRAPHIC SET PIXEL statement ................................................................... 556GRAPHIC SET POS statement ...................................................................... 556GRAPHIC STRETCH statement .................................................................... 557GRAPHIC STYLE statement ......................................................................... 557GRAPHIC TEXT SIZE statement ................................................................... 558GRAPHIC WIDTH statement ........................................................................ 558GRAPHIC WINDOW statement ..................................................................... 558GRAPHIC WINDOW END statement ............................................................. 559GUID$ function .......................................................................................... 559GUIDTXT$ function .................................................................................... 560HEX$ function ............................................................................................ 560HI function ................................................................................................ 561HIBYT function .......................................................................................... 561

  • PowerBASIC Compiler for Windows Version 8

    19 / 749

    HIINT function .......................................................................................... 562HIWRD function ......................................................................................... 562HOST ADDR statement ............................................................................... 562HOST NAME statement ............................................................................... 563IF statement .............................................................................................. 564IF/END IF block ......................................................................................... 565IIF function ............................................................................................... 566IMP operator ............................................................................................. 567INCR statement ......................................................................................... 567INPUT# statement ..................................................................................... 568INPUTBOX$ function .................................................................................. 569INSTR function .......................................................................................... 569INT function .............................................................................................. 570INTERFACE/END INTERFACE block ............................................................. 570ISFALSE operator ....................................................................................... 571ISNOTHING function .................................................................................. 572ISOBJECT function ..................................................................................... 573ISTRUE operator ........................................................................................ 573ITERATE statement .................................................................................... 574JOIN$ function .......................................................................................... 575KILL statement ........................................................................................... 575LBOUND function ....................................................................................... 576LCASE$ function ........................................................................................ 576LEFT$ function .......................................................................................... 577LEN function .............................................................................................. 577LET statement ........................................................................................... 578LIBMAIN function ....................................................................................... 580LINE INPUT# statement ............................................................................. 583LISTBOX ADD statement ............................................................................. 584LISTBOX DELETE statement ........................................................................ 584LISTBOX GET TEXT statement ..................................................................... 584LISTBOX RESET statement .......................................................................... 585LISTBOX SELECT statement ........................................................................ 585LO function ............................................................................................... 586LOBYT function ......................................................................................... 586LOC function ............................................................................................. 586LOCAL statement ....................................................................................... 586LOCK statement ......................................................................................... 587LOF function .............................................................................................. 588LOG function ............................................................................................. 588LOG2 function ........................................................................................... 589LOG10 function ......................................................................................... 589LOINT function .......................................................................................... 590LOWRD function ........................................................................................ 590LPRINT statement ...................................................................................... 590

  • PowerBASIC Compiler for Windows Version 8

    20 / 749

    LPRINT ATTACH statement ........................................................................ 591LPRINT CLOSE statement ........................................................................... 592LPRINT FLUSH statement ............................................................................ 593LPRINT FORMFEED statement ..................................................................... 593LPRINT$ function ....................................................................................... 593LSET statement .......................................................................................... 594LSET$ function .......................................................................................... 594LTRIM$ function ........................................................................................ 595MACRO/END MACRO block ......................................................................... 595MAK function ............................................................................................. 599MAKDWD function ...................................................................................... 600MAKINT function ....................................................................................... 600MAKLNG function ....................................................................................... 600MAKPTR function ....................................................................................... 601MAKWRD function ...................................................................................... 601MAT statement .......................................................................................... 602MAX function ............................................................................................. 603MCASE$ function ....................................................................................... 603MENU ADD POPUP statement ...................................................................... 604MENU ADD STRING statement .................................................................... 604MENU ATTACH statement ........................................................................... 605MENU DELETE statement ............................................................................ 606MENU DRAW BAR statement ....................................................................... 606MENU GET STATE statement ...................................................................... 606MENU GET TEXT statement ......................................................................... 607MENU NEW BAR statement ......................................................................... 607MENU NEW POPUP statement ..................................................................... 608MENU SET STATE statement ....................................................................... 608MENU SET TEXT statement ......................................................................... 608MID$ function ............................................................................................ 609MID$ statement ......................................................................................... 609MIN function ............................................................................................. 610MKBYT$ function ....................................................................................... 611MKCUR$ function ....................................................................................... 611MKCUX$ function ....................................................................................... 612MKD$ function ........................................................................................... 613MKDIR statement ....................................................................................... 614MKDWD$ function ...................................................................................... 614MKE$ function ........................................................................................... 615MKI$ function ............................................................................................ 616MKL$ function ............................................................................................ 617MKQ$ function ........................................................................................... 617MKS$ function ........................................................................................... 618MKWRD$ function ...................................................................................... 619MOD operator ............................................................................................ 620

  • PowerBASIC Compiler for Windows Version 8

    21 / 749

    MOUSEPTR statement ................................................................................ 620MSGBOX function ....................................................................................... 621MSGBOX statement .................................................................................... 622NAME statement ........................................................................................ 623NEXT statement ......................................................................................... 624NOT operator ............................................................................................ 626NUL$ function ........................................................................................... 627OBJACTIVE function .................................................................................. 627OBJECT statement ..................................................................................... 628OBJPTR function ........................................................................................ 629OBJRESULT function .................................................................................. 629OCT$ function ........................................................................................... 630ON ERROR statement ................................................................................. 631ON GOSUB statement ................................................................................. 631ON GOTO statement .................................................................................. 632OPEN statement ......................................................................................... 633OPTION EXPLICIT statement ...................................................................... 636OR operator .............................................................................................. 636PARSE statement ....................................................................................... 637PARSE$