Run Windows prog for SOUND on a QB45 program ( NOT SO GOOD)

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
User avatar
I Daniel
Full Member
Posts:32
Joined:Thu May 13, 2010 10:42 am
Location:Pretoria South Africa
Run Windows prog for SOUND on a QB45 program ( NOT SO GOOD)

Post by I Daniel » Sat Jun 26, 2010 9:49 am

Good day everyone

In Windows 98 there is a program START.EXE. I use it to run windows programs from within a QB45 program. I installed it under C:\QB45
I tried it again this morning and it still works under XP PRO SP3.
To see how to use it. Go to Command prompt CD to the directory where it is installed and then type Start /?.

One catch when it finishes the windows prog, my basic prog sits on the task bar and I have to click it to get back to where I was. Usually my Menu.

Q: Does anyone know how to get my basic program back without having to click it on the task bar :?:
Last edited by I Daniel on Tue Jul 27, 2010 10:14 am, edited 3 times in total.

User avatar
BurgerBytes
Jr. Member
Posts:22
Joined:Thu Aug 06, 2009 7:44 pm
Location:Pittsburgh, PA, United States

Post by BurgerBytes » Sun Jun 27, 2010 1:42 am

You can run almost any program using SHELL. You can even go to the web by shelling a link. Your default browser will take you there.

One possible problem when running other programs in QB is that not only is your program minimized, it freezes when in graphics fullscreen modes.
To avoid locking up the program, IMMEDIATELY after shelling a command change SCREEN modes.

If you were in SCREEN 12, then change to another mode and back like this:

SCREEN 0
SCREEN 12

You will have to create a new screen of course. As far as I know, QB will always go to the taskbar unless you are in a SCREEN 0 window mode.
I wish it could.
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip

User avatar
I Daniel
Full Member
Posts:32
Joined:Thu May 13, 2010 10:42 am
Location:Pretoria South Africa

Run a windows prog to add SOUND to a QB45 Prog

Post by I Daniel » Sun Jun 27, 2010 9:26 pm

Okay I cheated. Fishing for info because I could never figure it out for a graphics screen.
Here is a snippet from my prog of approx about 21 years ago: It is mainly for short boom bang crash thats it, wrong etc (1-3 second )
You could play a music file but oh boy you must wait untill it finishes before the program can continue.

REM $DYNAMIC
CLEAR
DIM SHARED GetAnswer$, PlayIt$ ' Essentials from original program
SCREEN 0
WIDTH 80, 43
COLOR 14, 11
CLS

' Snippet from a program to add sound/music to a qb45 file
' Author : D M J Cronje. Coded 1989-09-26
' Translated to English and fully commented on 2010-06-25
' Run any DOS or WINDOWS program with the 'COMMAND` START (WIN98SE)
' This snippet is to play wave files
' I have not yet tried it using any other MediaPlayer but it should work.
' Almost a DOS version of WINDOWS RUNDLL32
' SNDREC32.EXE plays *.wav files but not MP3, Ogg
' It works on SCREEN 0
' Any other mode completely messes up my Screen display
' My screen card is a Nvidia Gforce 5500 using Microsoft's driver
'***** Switches for use with START.EXE *****
' /m Minimized in background
' /max maximized in foreground
' /r Restored in foreground (default)
' /w Wait. Will not return until the other program exits
'***** The following lines are to check if it works *****
LOCATE 1, 1: PRINT STRING$(79, "*");
LOCATE 4, 12: PRINT "Start";
LOCATE 16, 1: PRINT STRING$(79, "*");
'**** Do not use this it leaves your program minimized on the Task Bar
'**** SHELL "C:\WINDOWS\SNDREC32.EXE /open /play /close C:\WINDOWS\MEDIA\TADA.WAV"
'The following is the original code
'PlayIt$ = "START /m /w C:\WINDOWS\SNDREC32.EXE /open /play /close" + GetAnswer$

PlayIt$ = "START /m /w C:\WINDOWS\SNDREC32.EXE /open /play /close" + " C:\WINDOWS\MEDIA\CHIMES.WAV"
SHELL PlayIt$
LOCATE 6, 2: PRINT "That was CHIMES.WAV using a string ie PlayIt$ to play it"

SHELL "START /m /w C:\WINDOWS\SNDREC32.EXE /open /play /close C:\WINDOWS\MEDIA\TADA.WAV"
LOCATE 19, 2: PRINT "That was TADA.WAV using file TADA.wav"

COLOR 30 '**** 15 added to color to make it flash
LOCATE 25, 12
PRINT "Success ";
COLOR 15
PRINT "I am back in my QB45 program"
LOCATE 30, 12
PRINT "Waiting for a key press"
Wag$ = INPUT$(1) 'Wag=Wait for a keypress. Easier than using an INKEY$ loop
END

:evil:
Passions: MyWife&Family QB4.5 Electronics Computers Hypnosis Humanity AncientHistory ReligionS. Psychology, Yoga Radio-Rx/Tx
(I trade you my mind)

User avatar
BurgerBytes
Jr. Member
Posts:22
Joined:Thu Aug 06, 2009 7:44 pm
Location:Pittsburgh, PA, United States

Post by BurgerBytes » Tue Jun 29, 2010 6:57 am

I thought using START would allow your program to continue in SCREEN 0 window mode. It shouldn't even be minimized like graphics screens.
Get my QB demonstrator here: http://dl.dropbox.com/u/8440706/Q-Basics.zip

User avatar
I Daniel
Full Member
Posts:32
Joined:Thu May 13, 2010 10:42 am
Location:Pretoria South Africa

Run windows prog to add sound to a QB45 prog

Post by I Daniel » Tue Jun 29, 2010 11:29 am

Ouch.
So let us Debug my snippet:

1. Path to sndrec32.exe : It is normally under c:\windows\system32 :
It was not on my PC so I extracted it from SP2 to the wrong
directory. Sorry
2. Path to the Chimes and Tada.wav files. check if they are where they
are supposed to be: C:\windows\media

If these are not correct Sndrec32.exe generates an error, goes to sleep
on the task bar and your program waits forever for it to return.

I did pick up another bug. Sndrec32.exe is supposed to close, but every time I called it I found it on the task bar after my prog ended.
I went to it and changed the Properties: Compatility - Windows98/ME.
My snippet runs in QB45 and as a stand-alone EXE. It returns to the next line in my prog and now with the Compatibility changed it no longer
leaves sndrec32 on the task bar. (I cannot recall having this bug in WIN98SE)
Passions: MyWife&Family QB4.5 Electronics Computers Hypnosis Humanity AncientHistory ReligionS. Psychology, Yoga Radio-Rx/Tx
(I trade you my mind)

User avatar
I Daniel
Full Member
Posts:32
Joined:Thu May 13, 2010 10:42 am
Location:Pretoria South Africa

run windows prog to add sound to a qb45 prog

Post by I Daniel » Tue Jun 29, 2010 4:11 pm

Hi

One other point: the screen must be SCREEN 0 : WIDTH 80 , 43
Sndrec appears to use this screen size and if anything else is used
say 80, 25 or width 40,25 it returns to a 80,43 screen. which leaves u with a tiny sized screen.

************* BAD NEWS ******************
I never used it for anything else than sndrec32. On trying it on a rather large program for a Club to which I added a choice to (SHELL Start) explorer.exe, after closing explorer my prog just sits minimized on the task bar. MS is frustrating and stinks.

User avatar
I Daniel
Full Member
Posts:32
Joined:Thu May 13, 2010 10:42 am
Location:Pretoria South Africa

SNDREC.EXE

Post by I Daniel » Thu Aug 19, 2010 9:56 am

I tried SNDREC running QB4.5 on DOSBOX 0.74 the result was "This program cannot run in DOS mode"
Passions: MyWife&Family QB4.5 Electronics Computers Hypnosis Humanity AncientHistory ReligionS. Psychology, Yoga Radio-Rx/Tx
(I trade you my mind)

Post Reply