Is FreeBasic A Decent Alternative To VisualBasic 6?

New to FreeBASIC? Post your questions here.
BadLarry
Posts: 3
Joined: Jun 19, 2020 14:52

Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby BadLarry » Jun 19, 2020 15:00

Hello all. I used Visual Basic 6.0 for a few years until about 2016. Now I need a decent alternative that isn't dying (*cough* VB.Net). Is FreeBasic a good choice, or should I use a different language?
MrSwiss
Posts: 3610
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby MrSwiss » Jun 19, 2020 17:50

Hi BadLarry,

since the term 'decent' is freely interpretable, I'm unwilling to open this 'can of worms'.
Please specify, as cosely as you can manage, your interpetation of 'decent'.

AFAIK, VB is all OOP with lots of predefined classes ...
FB has none of that, without external libraries (its pretty low-level, similar to C).
caseih
Posts: 1536
Joined: Feb 26, 2007 5:32

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby caseih » Jun 19, 2020 18:07

If you're looking for a language with a built-in GUI form system and an integrated, rapid development designer, then no, FreeBASIC is definitely not an alternative to VB 6. Something like gambas is more equivalent to VB6, but not a direct drop-in replacement.

All that said, with external GUI libraries, FB can do everything VB 6 did and much more in the hands of an experienced programmer.
BadLarry
Posts: 3
Joined: Jun 19, 2020 14:52

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby BadLarry » Jun 19, 2020 19:02

Basically, I need a language that is easy to use, is similar to vb6, and can be run on Windows and Mac OS. Support for object Oriented programming would be nice, but it isn't required in my case. Support for game creation and text-to-speech functionality would be nice as well (I used to write games for the blind in my spare time, when I wasn't writing more serious applications.)
MrSwiss
Posts: 3610
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby MrSwiss » Jun 19, 2020 19:15

BadLarry wrote:I need a language that is easy to use, is similar to vb6, ...
If you are speaking about BASIC-like syntax, but more advanced then, you're on the right track.
Limited OOP support is there, but no multiple inheritance (you'll write the 'boilerplate-code' yourself).

game creation
Some members have 'diddled' with game-engines (don't know if they're any good).

text-to-speech functionality
Seems to call for external library ...
dodicat
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby dodicat » Jun 19, 2020 19:33

Freebasic can handle vbscripts very easily if that is a half way step.
A gui, seems that the winapi would suit fine, that is what vb uses behind the scenes.
The windows section is mainly win api.
I assume you have freebasic to run this script stuff.

Code: Select all

 
function pipeout(byval s as string="") byref as string
    var f=freefile
    dim as string tmp
    Open Pipe s For Input As #f
     s=""
    Do Until EOF(f)
    Line Input #f,tmp
    s+=tmp+chr(10)
    Loop
    close #f
    return s
end function


 function runscript(text as string) as string
    Dim As long n=freefile
    If Open ("Tmp.vbs" For Binary Access Write As #n)=0 Then
        Put #n,,text
        Close
        end if
   function= pipeout ("cscript.exe /Nologo "+ "Tmp.vbs")  ' or wscript.exe
   kill "Tmp.vbs"
end function

sub speak(text as string)
      dim as string x="mshta vbscript:Execute(""CreateObject(""""SAPI.SpVoice"""").Speak("""""+text+""""")(window.close)"")"
      print  text
      shell x
  end sub


  dim as string s="Set h = CreateObject(""Scripting.Dictionary"")"+ chr(13,10)
    s+="h.Add ""A"", 1" + chr(13,10)
    s+="h.Add ""B"", 2" + chr(13,10)
    s+="h.Add ""C"", 3" + chr(13,10)
    s+="Wscript.Echo h.Item(""A"")" + chr(13,10)
    s+="h.Item(""C"") = 4" + chr(13,10)
    s+="h.Key(""C"") = ""D""" + chr(13,10)
    s+="Wscript.Echo h.exists(""C"")" + chr(13,10)
    s+="h.Remove ""B""" + chr(13,10)
    s+="Wscript.Echo h.Count"+ chr(13,10)
    s+="h.RemoveAll" + chr(13,10)
    s+="Wscript.Echo h.Count"
   
    speak("example from rosetta code, v b a linked lists, converted to v b script")
   
    print runscript(s)
    speak "Bye"
   
    sleep
   

   
 
MrSwiss
Posts: 3610
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby MrSwiss » Jun 19, 2020 19:37

@dodicat, since when is WinApi compatible with Mac-OS? (without emulators, that is)
OP clearly wrote:... can be run on Windows and Mac OS.
dodicat
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby dodicat » Jun 19, 2020 19:41

Mac, I forgot about that.
member srvaldez can help with fb code on Macintosh.
Probably more like Linux. I didn't realise that VB6 ran on mac, I know Microsoft word can, but sorry, don't know much about Mac.
BadLarry
Posts: 3
Joined: Jun 19, 2020 14:52

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby BadLarry » Jun 19, 2020 20:17

VB6 was never released on Macintosh, but I purchased a macBook last year and support for Macintosh would be useful.
Tourist Trap
Posts: 2933
Joined: Jun 02, 2015 16:24

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby Tourist Trap » Jun 20, 2020 15:24

BadLarry wrote:Hello all. I used Visual Basic 6.0 for a few years until about 2016. Now I need a decent alternative that isn't dying (*cough* VB.Net). Is FreeBasic a good choice, or should I use a different language?

Hi BadLarry,

I would say yes you can use Freebasic as an alternative where you will be abe to use a lot of Microsoft Basic well known stuff (like DIR etc..), and the winapi is handled the same way (importing functions is done in a similar way). However Freebasic doesn't support natively Variant, or VB6 classes. Also there is not an equivalent visual designer like the visual basic ones.

When you need more control of the memory (with pointers) , cross-plateform portability, and can afford to code without something like the visual basic editor (or visual studio like stuff), then you really can have great efficiency with FB. FB is also a good strategy if you think you'll need someday to use C libraries because FB then will interface with such lib rather naturally.

You also can use other languages anyway. In my opinion you may well find them not tasting very "basic", whereas Freebasic definitely does.
srvaldez
Posts: 2513
Joined: Sep 25, 2005 21:54

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby srvaldez » Jun 20, 2020 17:12

@BadLarry
if you want a cross-platform solution that has the functionality of VB6 then I recommend Lazarus, it's Pascal but it's GUI designer works similar to VB6
alternately, you could give QB64 + Inform a try
MrSwiss
Posts: 3610
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby MrSwiss » Jun 20, 2020 21:58

A Gui library that looks 'native' on Win/Lin (and, should run on Mac too)
is IUP, for Win = WinApi backend, for UNIXy OS's = GTK backend.
The exposed programming interface is always the same, OS independant.

It links easily to FB, because it's native C (not C++ which requires wrappers).
Both static or dynamic linking is possible.
Headers are available in FB, albeit being pretty dated (approx. 5 years old).
Lost Zergling
Posts: 334
Joined: Dec 02, 2011 22:51
Location: France

Re: Is FreeBasic A Decent Alternative To VisualBasic 6?

Postby Lost Zergling » Jun 21, 2020 10:19

@BadLarry. TT wrote :
In my opinion you may well find them not tasting very "basic", whereas Freebasic definitely does.

I agree. As you re looking for "Spirit of Basic", I m convinced here is probably the right place. Welcome.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 4 guests