home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
QB45MULT.ZIP
/
QBMULT.DOC
< prev
next >
Wrap
Text File
|
1993-10-03
|
9KB
|
193 lines
QB 4.5 Multi-tasking library. Version 1.0
This library will allow you to produce Multitasking basic programs
using QB 4.5 basic system from MicroSoft.
Included in this package are the following files.
QBMULT.DOC - Getting started text file.
QB45MULT.LIB - The library that does the magic.
QB45MULT.BI - Include file for the library.
QBMKMULT.BAT - Batch file to compile and link your program.
SAMPMULT.BAS - Sample program.
EXEHDR.EXE - Program to modify EXE headers to ask DOS for less
than the max amount of memory.
EXEHDR.DOC - Doc file explaining how to use EXEHDR.
************************************************************************
Warning: While I have tested this software as best I could, I can not
foresee ever possibility that might come up! You use this software at your
own risk!
Primary testing was done under DOS 5.0.
I will not be held respondsable for any damage done, in any way, by the
use of this software.
*************************************************************************
Over View:
Programs written to use this software are constructed following a few
basic rules. There are three subs that MUST be in the program, and the
names MUST be unchanged. Any code in the sub BASICPROCEDURE will be multi
tasked with DOS. Code in BASICPROCEDURE2 will only be run when the hotkey
is pressed, and multi tasking is suspended while in the sub.
You will have to edit the QBMKMULT.BAT file to reflect your programs
name, and maybe the paths. No QLB is included in the package. No calls to
basic from 'C' are allowed when working within QBX, so a QLB is pointless.
This will make your debugging a bit harder, but there are ways around that,
too.
To get started, load up the sample program and take a look at how
it's done. Notice the #include at the top. This MUST be there! Forget this,
and you go nowhere fast.
The main module is where you will want to do your variable setup and
type commands. With a TSR, it's important that you declare all variables
you can before going resident. This makes it easier to determine the amount
of memory you want the program to reserve for itself, before turning the
rest back to DOS.
With QB 4.5, we have to modify the EXE files header to ask DOS for
less than all of available memory. I've included a program to do that.
Now, you need to determine the hotkey that will popup your one
procedure. When pressed, a sub in your program will be called. Once again, the
program SAMPMULT has some comments showing how it's done.
All that remains in the main module is to call 'GoMult'.
It takes one perimiter, which you can use to load and NOT go resident if
you like. A value of zero will load as a TSR. A value of one will load and
run procedure one without going resident.
The program will never come back from GoMult if the load went ok.
It will come back if a value of one is used.
From there on, your resident and running in the background.
The sub 'BasicStartup' will be called once, and only once, when the
program has been installed. As this is called after the system is
installed, you can be pretty sure you really ARE resident if you make it
this far. For this reason I like to use this to print a line or two
telling the user we are resident.
The sub 'BasicProcedure' will be run in the background. This is where
you should put your code. If you declare all your variables shared in the
main module, they will be available as they always were. You can do some
dynamic variable allocation here, as long as most stay in DGROUP. See your
manual. Far strings are ok, but rather defeat the concept of a TSR.
The sub 'BasicProcedure2' is called when your hotkey is pressed. All
multitasking will be suspended while in this sub. I use it as an exit
routine. You could of course use it for whatever you like.
The commands avaliable to you are listed below. Very little checking
is done to see that the values passed are valid, so keep an eye on it.
GoMult (a%) -
Installs the TSR. a% can equal 0, 1, or 2.
Zero will install as a TSR.
One will not go TSR, and run basicprocedure.
Two will not go resident, and run basicprocedure2.
Use a value of one or two when testing, or if running under another
multitasker.
a%=checkinstalled -
Checks to see if the program has been loaded before. You can still load it
again, but I see little point. It simply gives you an out if you want it.
exitmult -
When called, it sets a flag indicating you wish to deinstall the TSR. You
must call it, and then exit the sub before it takes place. One other thing.
It will not uninstall if a program has been loaded after it to prevent
memory arena problems. You will have to exit the other program first, then
try again.
sethotkeys (key%, keyflag%)
Sets the hotkey to use to pop up. It takes two values. The first is
the ascii code of the key, and the second is the scan code for ALT, CTL or
whatever. As a programer, you might be nice and use COMMAND$ to let the end
user pick these keys...
yield-
Gives the rest of this timer tick back to the foreground task. Use of
this when you can will make the foreground task more responsive.
Recomend you use whenever and where ever you can!
Do not use if you are not going resident! The sample program shows a
simple way around it.
That concludes the list of commands. Not much to it, is there? The
idea is to let the programmer produce TSR's without a lot of hassle. I
think I have done that. Heck, let me know what YOU think!
**************************************************************************
Random thoughts, misc blatherings...
Try to keep the memory used as low as you can. While this is not easy
in PDS, it's still a worthly goal.
Third party librarys should work ok when used with PDSMULT. I'm real
interested in finding which do and which do not. You might consider
dropping me a card letting me know what you discover.
For that matter, I wonder what size EXE we would get if we combine PDQ
or QBTINY with PDSMULT? Hmmmm...
The method used to see if it's already been loaded is not fool proof.
It has the little bug that it will think ANY program loaded using this
library is itself. I'm working on that, but thats why I let you go ahead
and load it if you like...
This is version one. I want, nay, I NEED your input for version two!
It costs very little really to call and tell me your ideas. I have a LOT of
ideas, as I'm sure you have, of changes that can and should be made. Let me
know!
This version is really a demo. I included a screen that pops up when
you run the program. Sorry, but I have 12 other shareware programs out
there, and the only registrations are in the ones I limited in some way.
That screen is of course removed in the normal version.
The shell command can not be used. Once you go resident, it's a pain
to allocate memory again. I'm looking at ways around this....
Inkey$: Well, it works, but not very well. You can hardly tell which
task will get the keystroke. The result is not very pretty.
Some times things will not work correctly once resident. An example
was a test program I wrote that did file I/O. It crashed every time on the
OPEN command. I finally figured out it was the file number holding things
up. I got it up and running by changing 'OPEN "TEST.FIL" FOR RANDOM AS #1'
to 'NEXTFREEFILE% = FREEFILE: OPEN "TEST.FIL FOR RANDOM AS #NEXTFREEFILE%'
Viola! It works. I point this out so you will be aware that you may
have to look at a problem from a slant sometimes.
**************************************************************************
Support:
I can provide support for this LIB my mail or by a voice phone call.
Mail is preferred if it's nothing you need TODAY. Also, I respond to
registered users before any others.
If you have to, call voice evenings. Please keep in mind the time
zones!
The price for QB45MULT is $49.00. Send a check to the address below, and
I'll mail out your copy on 5 1/4 floppy the next day.
All orders will be shipped on 360k 5 1/4 floppy.
This price is good until 01/01/94. After that, please call.
Doug Miller
11765 CR 50.
Ligonier, IN. 46767
Voice#219-894-4024