Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Quick Timer Question
Message
From
27/06/2012 10:53:29
 
 
To
27/06/2012 09:54:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 7
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01547056
Message ID:
01547064
Views:
50
>>Hello again
>>
>>Added a timer to a form that displays test questions.
>>
>>Timer Interval = 500
>>Timer event code is:
>>
>>if Thisform.lblTime.Caption <> time()
>>  Thisform.lblTime.Caption = time()
>>endif
>>
>>
>>There is another label on the form that informs the student the time at which the test will end (FinishTime).
>>
>>Data is held on the server, logic for the screen is
>>
>>Has time() exceeded FinishTime
>>if yes
>> exit application
>>else
>> get next question from tables
>> display question stemulus and answer choices on screen (with @says and general fields don't ask
>> wait through a for loop (1 - 5,000,000 counter)
>> call Windows Sound Player to play recorded portion of question
>> ask for student response
>> 'grade' response and calculate next question value
>>endif
>>
>>Rinse and repeat above until calculations hit a specific value, or time exceeded, then score and exit test.
>>
>>This is in 8 labs, each having 19 stations
>>
>>Now, to make a long story even longer, here's the issue
>>
>>Since I've added the timer, what were seeing, beginning when we hit what I'd consider a moderate load on the network, is that the sound plays first, then the choices display on the screen.
>>
>>Would increasing the timer interval help with this? If not, any ideas?
>>
>>Thanks
>>
>>D
>
>How do you play the sound ? Is it with http://msdn.microsoft.com/en-us/library/windows/desktop/dd798676(v=vs.85).aspx
>
>If yes, try playing it ASYNC and see whether it helps
>
>The flags you would be using
>
>
>bitor(SND_NODEFAULT, SND_ASYNC)
>
>#define SND_SYNC            0x0000  && play synchronously (default) */
>#define SND_ASYNC           0x0001  && play asynchronously */
>#define SND_NODEFAULT       0x0002  && silence (!default) if sound not found */
>#define SND_MEMORY          0x0004  && pszSound points to a memory file */
>#define SND_LOOP            0x0008  &&  loop the sound until next sndPlaySound */
>
>
>Or
>
>Display the choices first + DOEVENTS + play the sound

The commands for the sound player are:
#Define SND_SYNC 0
#Define SND_ASYNC 1
#Define SND_NODEFAULT 2
#Define SND_MEMORY 4
#Define SND_LOOP 8
#Define SND_NOSTOP 16

Declare Integer sndPlaySound In winmm;
STRING lpszSound, Integer fuSound

and to play the sound:

= sndPlaySound(WavFileName, SND_SYNC + SND_NODEFAULT)

I need the program to wait until the sound finishes before I display the "Select Answer:"
And the logic is, display choices, play sound, get answer.
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform