
VBDOS Basic DOS using Timer in Windows DOS box
Help please!
I have an application that was written to run under dos in
Quickbasic/Visual Basic.
This app also needs to run in under windows. It works fine if it is run
full screen, or
in the foreground. If it is run in the background, then it doesn't work
properly.
The program uses the Timer and is illustrated below:
''''''''''''''''''''''''''''''''''''''''''
CLS
SysTime# = NOW
SysTime2# = NOW
CONST TimeDifference = 1
ON TIMER(1) GOSUB times
TIMER ON
DO
LOOP UNTIL INKEY$ <> ""
END
times:
SysTime2# = SysTime#
SysTime# = NOW
LOCATE , 1: PRINT FORMAT$(SysTime#, "dd-mm-yyyy hh:mm:ss"),
FORMAT$(SysTime2#, "dd-mm-yyyy hh:mm:ss"); " Elapsed Time = ";
FORMAT$(SysTime2# - SysTime#, "hh:mm:ss")
RETURN
''''''''''''''''''''''''''''''''''''''''''
If the app is run in the foreground, it runs at a higher priority and
correctly displays
the time every second. If it is run in the background, it runs at a lower
priority. It
recieves fewer timer clicks, and consequently, timer functions and sleep do
not work as
they should - they run more slowly. This app when run in the background
displays the
time about every 9 seconds under windows 95 and every 16 seconds under
windows 3.11.
What I want to do is what the Microsoft utility MSD.exe does when you start
it. If it is in
a window it switches to full screen before running. I presume it is
calling some function
under windows to do this but I cannot find how it is done.
Alternatively I need to boost the priority of the background task.
The solution has to work under Windows 3.11, 95, NT 3.51, NT 4.00.
Any help would be greatly appreciated!
Thanks
Stephen Roberts