Click here to Skip to main content
13,250,182 members (58,107 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.4K views
Posted 2 Nov 2016

Learning to code using the WIN32 the easy way, using BASIC

, 2 Nov 2016
Rate this:
Please Sign up or sign in to vote.
One of the challenges which I have felt made the WIN32 API dfficult to learn is that it leaned heavily on C and as a long time BASIC programmer, I always felt the C language syntax was terse in nature and that it lacked the natural syntax of languages like BASIC.

One of the challenges which I have felt made the WIN32 API dfficult to learn is that it leaned heavily on C and as a long time BASIC programmer, I always felt the C language syntax was terse in nature and that it lacked the natural syntax of languages like BASIC. Just look at C and other languages like it and the use of the curly brackets. Why does a programming language need curly brackets to indicate blocks of code ? It doesn’t. Likely the curly bracket was helpful to the compiler to make things easy on the compiler rather than the programmer. Today’s programmers may not appreciate this, but old time programmers like myself who date back to the days of early computers may. In the old days, computers were very slow and it took a very long time just to compile a decent sized program. Programmers joked about taking a coffee break while their code compiled. Likely many a programming language syntax had more to do with making it easier and faster for the compiler rather than make life easier for the programmer. Amazingly BASIC as a language stuck to the old credo of “keep it simple” and advances in computer technology have benefited BASIC.

BASIC, your fathers BASIC and more.

There are two types of BASIC. One group which follows the object oriented path, such as classic Visual Basic and the other which follows the procedural path like old time C does. OOP hides the roots of Windows behind classes and objects, while languages like C (not C++) bring programmers closer to how Windows really works. If you want to write the smallest and best performing application for Windows, you use pure C. But what if BASIC could do what C does ? Actually it can. The beauty of BASIC over the years has been that it wasn’t afraid to borrow the best from other languages. BASIC quickly borrowed from Pascal with true subroutines and functions. Some versions of BASIC have borrowed heavily from C with low level functionality like code and data pointers, etc. BASIC at times has even borrowed from Assemblers by adding inline assembly code support. Now imagine what a WIN32 programmer can do with BASIC. With all the fuss about IOT (Internet of Things) and x86 based mobile devices (aka. small tablets) today, being able to write those amazingly fast and tiny applications using a fast BASIC compiler makes a lot of sense.

Where does one start ?

Are you interested in learning how to code using the WIN32 API, but using BASIC rather than C ? Well, first off you need to start with a decent native code BASIC compiler for Windows. There are a few I will mention, but one stands out in my opinion (which I will get to later).

  • FreeBasic

The first to mention is FreeBasic (for more info see website) .  FreeBasic is a powerful compiler which supports what you need to work with the WIN32 API, including pointers and inline assembler. The best thing about it is that it is free.

  • PureBasic

Next is PureBasic. Purebasic is cross platform and even supports 3D via an open source 3D engine integrated into it. PureBasic is well supported and is well suited to building WIN32 applications. ( for more info see website ).

  • Oxygen

This is an unusual compiler in that it can be embeded into other applications to add compiling capabilities to your application. While the feature list is limited, it can be used to create applications which generate executables. It is often used in combination with a great BASIC interpreter called ThinBasic. (for more info about Oxygen see website ).

  • PowerBasic

PowerBasic is unique among BASIC compilers for a number of reasons. First it has the longest history of any Windows BASIC compiler. PowerBasic dates back to Borland International’s famous TurboBasic and back in the day it was the only other BASIC compiler which came close to competing with Microsoft QuickBasic. Because of its long history it has one of the best syntaxes for a BASIC because it has maintained much of BASIC’s original flavor (started by Microsoft QuickBasic), while borrowing from other languages but with the original BASIC mindset. Second, unlike many of the current generation BASICs still available, it is not simply a code generator using another language as a backend, but it is a true 100% compiler generating directly to machine code. The compiler itself was written in assembler so it compiles at lightning fast speed, even on old hardware (don’t need the lastest and best PC just to get decent compiled speeds). It was designed specifically for Windows and Windows only and does not have to deal with all the cross platform issues. It was also designed specifically for coding using the WIN32 API. While it is a commercial compiler, the company has just recently turned their previous version compiler into a freeware product, which means like Freebasic and Oxygen it can be gotten for free. The 9.0 compiler version is extremely powerful. I could do most anything I wanted with the WIN32 API with as old as their 6.0 version, so the 9.0 free version is plenty for any budding WIN32 programmer. (see website for more info )  (to get free version of PowerBasic go here )

Yes, the BASIC compiler offerings for budding WIN32 programmers is currently quite rich. In future articles I may try to highlight some of the other lesser known BASIC’s. Also in future articles I will hopefully discuss how to code for the WIN32 using BASIC.  Here are a few Codeproject articles to help you get started:

Getting started with the PowerBasic compiler -Part 1

Getting started with the PowerBasic compiler -Part 2

 

 

 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Chris Boss
Software Developer Computer Workshop
United States United States
Chris Boss is the owner (and programmer) of a small software development business in rural Virginia, called the Computer Workshop. For the last ten years or so he has been developing tools for use by Powerbasic programmers (see: http://powerbasic.com ). His main product called EZGUI (Easy GUI) is a high level GUI engine with Visual Designer and code generator. It is in its fifth generation now. He is an experienced Windows API programmer (more low level) and has experience in writing GUI engines (forms/controls), drag and drop Visual Designers, Graphics engines (printing and to the screen) and one of his favorites is a Sprite engine (2D animated movable images). His current project is version 5.0 of his main product EZGUI, adding such features as multi-monitor support, component engine, custom control engine, superclass engine and the latest project a 3D OpenGL based custom control. One of the goals he has is to push the limits of Windows software development, while making it easy, fast execution speed, small footprint (size of executables) and code reusability while providing a more graphic experience in user interfaces, while still being able to write software which can fit on a floppy disk (small footprint), use minimal amount of memory and able to run on multiple versions of Windows from 95 to Win8.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionAI?? Pin
Matt T Heffron9-Nov-16 15:30
professionalMatt T Heffron9-Nov-16 15:30 
AnswerRe: AI?? Pin
Chris Boss10-Nov-16 4:42
professionalChris Boss10-Nov-16 4:42 
GeneralIt's almost 2017 Pin
salvuccio3-Nov-16 6:29
professionalsalvuccio3-Nov-16 6:29 
GeneralRe: It's almost 2017 Pin
Chris Boss3-Nov-16 8:25
professionalChris Boss3-Nov-16 8:25 
GeneralRe: It's almost 2017 Pin
salvuccio3-Nov-16 14:20
professionalsalvuccio3-Nov-16 14:20 
GeneralRe: It's almost 2017 Pin
Chris Boss3-Nov-16 18:13
professionalChris Boss3-Nov-16 18:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 2 Nov 2016
Article Copyright 2016 by Chris Boss
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid