Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QuickBasic for Windows

Status
Not open for further replies.

Nepheligenous

Technical User
Dec 11, 2002
17
0
0
I have been writing programs using QuickBasic at work for the past 2 or 3 years and was recently informed that they are going to do away with their DOS-based computers and replacing them with NT systems.

1) Will my QB programs work in the NT system?

2) Can I create QB programs to run on the NT systems? Where can I find information about interfacing QB with NT?

I would like to use the feature of the Windows (ie. create dialog boxes, windows, etc) using QB. Is this possible?

Thanks!
 
yes your qbasic programs will work in windows NT. Assuming that they are native qbasic, certain libraries such as future library will not work, especially in Windows XP (I am assuming this will be the one you switch to). They will be slower though, Windows XP has a poor emulator, it is much more stable, but slower.

You can not make Windows programs in Qbasic. But you have a wide variety of similar languages that do allow you to use windows features. Visual Basic, Liberty Basic...
 
Just to add to qbasicking, another language (although it shouldn't be considered a language perse) is the Windows Scrip Hosting (which will allow you to use the "widows features" you spoke of).

On my windows ME, there's a folder called Samples under the Windows folder. I'm certain that XP (home and pro vers) and W2k would have something similar where you can learn from.

--MiggyD
 
I think it depends a great deal on what you are doing in your QBasic programs.

Which NT OS? 4.0? 5.0 (Windows 2000)? 5.1 (Windows XP)?

Fancy graphics, numerous 16-bit libraries, direct twiddling of hardware or low-level DOS stuff... you'll see some limitations.

The most important factor I've seen under WinXP is to be sure you run your QBasic under command.com and not the 32 bit shell cmd.exe, which is the default NT command-line shell. This can be done by manually making PIFs invoke command.com and run QBasic or your compiled programs, or by starting a command.com shell from Start|Run and initiating 16-bit programs from there.

I'd be interested to hear in what ways NTVDM on WinXP is lacking. Compared to what? Native DOS?

I have compiled VBDOS programs that work fine under XP, windowed or full-screen. The real mode emulation seems fairly good for my purposes, and even software interrupt access to this "virtual DOS" works in many cases.

Of course the screen updates are faster full-screen than not. Even here you get DOS-mode character-graphics MsgBox's and dialogs though. Running the command prompt in 50-line mode makes VBDOS almost viable - good enough until my older stuff gets rewritten for Windows. That's true either under DOS or NT though.

VBScript makes a good free alternative for Windows programming. Windows Script Host is a good host for some scripting, though using IE as the host by writing HTAs (HTML Applicatons) offers a richer GUI model. Both script hosts have their places.

It is a little late to get on the VB5/6 bandwagon. You might consider looking at VB.Net or C#, which are free by installing the .Net SDK and an open source product called #develop. The VB5/6 forum here had a recent thread on this topic.
 
What I have been asked to write in the past (and I don't see that really changing in the future) are things like help files, employee warning generator programs, programs that read other files and compile (or rather, collate) all the information and write the result to another file, etc. No rocket science, for sure. But I was just wondering if I could create a more "Windows-like" appearance and make it look like the other Windows applications they run.

I was told by a friend about XBasic. He told me it was old but that it's a 32-bit/16-bit Basic which will work on XP (which is what I am assuming the company is going with).

Am I in left field? lol

Thanks!
 
Well if those Windows NT machines have IE 5+ deployed on them, to tell you the truth I'd look at using HTML Applications (HTAs) for much of this sort of thing.

An HTA is basically a stand-alone disk-based web page (.HTM) that uses DHTML (JScript and/or VBScript) inline. By naming it .HTA instead of .HTM you gain access to a more relaxed scripting security model than a normal web page has. There is also a special <HTA:Application> tag you can use to get some additional control over your HTA.

The user can run an HTA much like another real EXE from Windows, via the Start Menu or any shortcut - just double-click.

For anything that must be a command-line routine, use Windows Script Host ("WSH") instead.


While theoretically not as fast as a compiled program, these scripts are often much faster than a compiled 16-bit program. This seeming contradiction comes about because Windows Script can invoke some powerful 32-bit software components to do a lot of the compute-intensive heavy lifting. For example some amazing things can be done by using ActiveX Data Objects (ADO) to control the Jet database engine. Most people associate Jet with Access and MDBs, but it has a pretty fast and furious text data manipulation facility as well for bulk operations. This lets you do a lot just through SQL statements embedded in your scripts. You can also get "down and dirty" where need be and gut out the details explicitly in script code.

The one downside is that the power of these scripting tools means some vendors' malware control suites block the execution of these things. In reality they are no more dangerous than any EXE, but the assumption is that a user is smart enough not to download and run a random EXE but is stupid enough to do so with a .VBS, .WSF, or .HTA - go figure.

A WSH script has only limited inbuilt GUI capabilities, but an HTA can do anything you'd do in a web page and more.


This is such a great model for application development that it has been reinvented for the future Windows Longhorn product as "Avalon." They just replaced HTML with a new thing called "XAML" and replaced VBScript/JScript with VB.Net/C#, but essentially Avalon applications are HTAs.


You'll find HTAs fairly easy if you have some HTML background with a sprinkling of client-side scripting experience. In my opinion it is even more powerful if you use VBScript instead of JScript: there is an event-handler model almost identical to VB's if you use VBScript.

You can also write HTAs using anything from NotePad to Visual InterDev.

Plus, there is nothing to buy.


One place to start is to go to the VBScript forum here and do a keyword search on HTA.
 
VERY interesting information, dilettante, thank you. Can HTAs interface with hardware? For instance, can I access hard drives, printers, etc. with it? Can I create files (text files, really) with it? It does sound very interesting and I will look into anway.

I am also concerned about exposing the source code because people at work just love to do some creative editing - I found that out when I started writing DOS Batch files. I ended up having to compile them lol.

So those are my two problems - compilation and hardware access. If HTAs can meet these criteria then I will use it.

Thanks!
 
No true hardware access in the sense of physical ports, memory Peek/Poke operations, etc.

Text I/O is easy enough though, and an HTA can always be extended via ActiveX controls you write with VB5CCE (VB 5, Control Creation Edition - free from MS for te downloading) or VB5/VB6. In-built print support is somewhat limited, but this too can be extended through MS ActiveX controls that are installed with IE and scripting support, or via 3rd party or home-built ActiveX controls.

Compilation.. no.

There is of course the "script encoder" facility in MS scripting. Anything but hacker-proof, yet Joe User is not going to end up fiddling with your code.
 
as far as compiling... if you use java script, you can move the code areas to a java applet and compile it to binary code then call the appplets in your HTA...

You could probably do similar things with VB ActiveX controls, but if you start getting into that depth, you might as well just get a copy of VB6 and save yourself ALOT of time...

VB has the same general syntax structure as QB, with most of the same commands plus MANY improvements...

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Well JavaScript isn't really that close to Java. But VBScript does port to VB6 very easily. There is very little difference in base syntax.

It depends on your goals. I always saw VBScript in HTAs or WSH scripts as the Win32 version of QBasic. Interpreted and free (bundled).
 
Also, a CHM file is a compiled HTML... right?

So would you be able to create a HTA then compile it to CHM or is that mainly used for help files?

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Compile an HTA as a CHM?

I wish.

One of the nice things about CHMs is that they can "wrap up" a number of HTML pages that belong together as one entity. Of course you get other things like search capabilities, a sort of predefined tree-navigation pane, etc.

Nothing really keeps you from using script or ActiveX or java applets in there too though.

What I guess I don't know is how relaxed the scripting security model is for CHMs. I've never tried using them as anything but Help files so I've never gotten too wild about trying to do things like file or database I/O, executing external programs, communicating with servers, etc. This stuff is routine in HTAs of course.

In many cases my HTAs use auxilary HTM files and load them into IFRAME objects within the .HTA itself. This is where I'd like the idea of bundling in the other bits such as image files, those aux HTMs, and even CABs for components. Even an icon associated with an HTA is an external ICO file because there isn't any place to bundle it in.

One way to glob everything except the main HTA file itself together is to create a resource file containing all of those VBs, JSs, JPGs, and HTMs, etc. Then the HTA could get to those using IE's built in RES:// protocol.

I've never found a nice resource editor that made me happy though. The VB IDE resource editor is too targeted to VB programs to be helpful and I've been too lazy to look into doing this all manually the way a C/C++ programmer does it. That way you'd have only an HTA, an ICO, and a RES file - a little neater than my usual HTA plus a folder containing all the other individual resource files the application uses.

CHMs though hmm? You might have something there.
 
I want to say there is a program called something like... Resource Hacker... that they use on Tech TV (Screen Savers) all the time...

It is supposed to be one of THE BEST resource editors, though I don't know if it can be used to Create a resource file...

There are also quite a few GCC resource editors that use command line options to compile resorces...

If you are interested in resource hacker, search for it in the Screen Savers - Show Notes at Tech TV... (I thnk it is now...)

Ok, just looked it up...
Here is ResBuilder... their current favorite...

And Resource Hacker...

And both...

Good Luck ;-)

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
I'd vote for Liberty Basic ( - it's cheap (around $30), easy to use, pretty close syntactically to QBasic (and other classic flavors of the language) and has all the bells and whistles of the Windows environment on top of (most of) the classic BASIC commands. I've been working with LB for a couple of years - it's great for tasks suited to BASIC ... I've written an HL7 parser (HL7 is a hospital-specific language protocol for data interchange between systems) and am working on a flatfile database system ... both used in my work to make my life easier.

Tom

"My mind is like a steel whatchamacallit ...
 
There's also Visual Basic or Visual Studio. If that be an option, I'd try those.

grtz
 
Another option is IBasic from ... it's a pretty slick system, not expensive, and creates true .exe files unlike Liberty Basic which has a runtime environment and a bunch of dlls needed. You could very easily create a simple one-window message box in either, IBasic would probably be a bit faster in execution and easier by far to deploy.

"My mind is like a steel whatchamacallit ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top