Click here to Skip to main content
15,880,469 members
Articles / Desktop Programming / Win32

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

Rate me:
Please Sign up or sign in to vote.
4.62/5 (6 votes)
2 Nov 2016CPOL5 min read 10K   6
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

 

 

 

This article was originally posted at http://cwsof.com/blog?p=935

License

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


Written By
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.

Comments and Discussions

 
QuestionAI?? Pin
Matt T Heffron9-Nov-16 14:30
professionalMatt T Heffron9-Nov-16 14:30 
Why is this tagged as: "AI", "neural", "machine-learning"?

This clearly has nothing AI-ish about it.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G.K. Chesterton

AnswerRe: AI?? Pin
Chris Boss10-Nov-16 3:42
professionalChris Boss10-Nov-16 3:42 
GeneralIt's almost 2017 Pin
salvuccio3-Nov-16 5:29
professionalsalvuccio3-Nov-16 5:29 
GeneralRe: It's almost 2017 Pin
Chris Boss3-Nov-16 7:25
professionalChris Boss3-Nov-16 7:25 
GeneralRe: It's almost 2017 Pin
salvuccio3-Nov-16 13:20
professionalsalvuccio3-Nov-16 13:20 
GeneralRe: It's almost 2017 Pin
Chris Boss3-Nov-16 17:13
professionalChris Boss3-Nov-16 17: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.