Runtime for Windows 95 until Windows 10

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
Post Reply
Bad_Wolf
Posts: 2
Joined: Thu 05 Jul 2018, 06:00

Runtime for Windows 95 until Windows 10

Post by Bad_Wolf » Thu 05 Jul 2018, 06:04

Hi everyone,

I like to create an application which can be used from Windows 95 until Windows 10.

I assume that for Windows 95, I am not allowed to use any API at all, like for dialogs. I think I have to create everything in BBC Basic.

When I create a dialog completely in BBC Basic, can I have the program respond on events? Like mouseclick, mousedown events?

Thank you very much for yur help.

Chris

DDRM
Administrator
Posts: 59
Joined: Mon 02 Apr 2018, 18:04

Re: Runtime for Windows 95 until Windows 10

Post by DDRM » Thu 05 Jul 2018, 08:17

Hi Chris,

I'm not sure about the APIs that are common across that range: I guess the simplest thing would be to try and see! Obviously that may not be possible if you don't have access to all the target machines/OS's.

You certainly COULD make your own dialogue boxes, and you could detect mouse clicks etc either by using the MOUSE statement (which allows you to poll the state of the mouse - i.e. test what is happening at a particular time (or at least what is in the mouse event buffer) - or you could use ON MOUSE, which will generate interrupt events if the mouse buttons are pressed. A quick trial shows that this generates an event on button down, but not on button up, but you could test for this in the routine called in response to the interrupt by repeatedly calling MOUSE x%,y%,z% until z% went to 0.

You can use INKEY or INKEY$ to monitor what is in the keyboard buffer.

Hope that's helpful - if you want more specific advice, do post again.

If you are in the position of having to generate things like dialogue boxes yourself, it might be worth looking at BBC-SDL - the version intended for cross-platform use. It relies on the SDL library, and I'm not sure if that's available for "old" versions of Windows, but it includes libraries with routines to generate things like dialogue boxes and their component elements which are built entirely in BBC BASIC code, so you might be able to use those directly, or adapt them to your needs.

Best wishes,

D

Zaphod
Posts: 39
Joined: Sat 23 Jun 2018, 15:51

Re: Runtime for Windows 95 until Windows 10

Post by Zaphod » Thu 05 Jul 2018, 23:28

Chris, good news!

Windows 95 was the first 32 bit Windows and the WIN32 API should work just fine for the most part. You may need to look at MSDN for a particular call to see which versions it is applicable to. Make sure you look at WIN32 and not any .NET versions. There were new API's added all the time but Windows 98, Windows 2000 and Windows Vista all introduced quite a few that may not work on Windows 95 because it will not have the correct DLL's. I believe that there are some issues with the help files not working on 95 because it needed Internet Explorer to be loaded and perhaps other things. However, from Windows 98 onward it should all be fine and it is advertised as being suitable for all versions later than Windows 95 i.e. Windows 98, Me, 2000, XP, Vista, Windows 7, Windows 8/8.1 or Windows 10. Indeed, I have run it on all those over the years and remain very impressed with it's capabilities.
All the supplied libraries will work so any API calls that they use are obviously OK for you to use.
There are some slight changes to Version 6 of BB4W but all the Examples should work on older systems just as well as modern ones if a little slower.
If you use Windows controls and the mouse then you will get interrupts that you can detect with ON SYS or ON MOUSE. Indeed I would assume that you can run just about anything that has been published as the Author has been very keen to maintain compatibility. If there are any differences they are listed in the help file.
Mouse events are quite limited and you get the click event as the mouse is released. But you can poll the mouse with the MOUSE keyword and find out if any of the buttons are pressed or not as David mentioned.
But try the Dialog Editor first before trying to write your own. It is DLGEDIT.BBC and will be in the Tools sub-directory in your examples folder. With a default installation it should be here:
"C:\Program Files (x86)\BBC BASIC for Windows\EXAMPLES\TOOLS\DLGEDIT.BBC" or C:\Program Files\BBC BASIC for Windows\.... perhaps on older Windows versions.

The demo version should show up any problems on Windows 95 if you need to find out before parting with your cash. If won't compile but running under the IDE should show any incompatibilities.

This page will give you just about all the info you need.

Z

DDRM
Administrator
Posts: 59
Joined: Mon 02 Apr 2018, 18:04

Re: Runtime for Windows 95 until Windows 10

Post by DDRM » Fri 06 Jul 2018, 07:49

Richard Russell confirms that dialogue boxes etc will all work fine in Win95 (and all subsequent versions). He also comments that BBC-SDL relies on SDL 2.0, which itself requires at least Windows Vista, so that is NOT a viable route for the earlier versions. Returning to MY view: you might still find useful code in the libraries, many of which use pure BBC BASIC code to produce equivalents of Windows things.

Minor correction to Zaphod's contribution: as noted in my previous email, ON MOUSE generates events when the mouse key is PRESSED not when it is RELEASED: here's some test code (use ESC to get out of it, or stop it in the IDE) - try pressing and holding a mouse button down, then releasing it.

Code: Select all

      ON MOUSE PROCmouse(@lparam%,@wparam%):RETURN
      REPEAT WAIT 1 UNTIL FALSE
      END
      :
      DEFPROCmouse(l%,w%)
      PRINT "Click"
      ENDPROC
Best wishes,

D

Zaphod
Posts: 39
Joined: Sat 23 Jun 2018, 15:51

Re: Runtime for Windows 95 until Windows 10

Post by Zaphod » Fri 06 Jul 2018, 12:23

My apologies.
David is, of course, correct about mouse interrupts and I am embarrassed that I wrote otherwise.

Z

Post Reply