I have a sound wav file that must first play for about 5 sec and then data must be added to a field only. Currently the sound start to play and a 1 second later the data is added to a table
My code i currently use is - Dim iRetValue As Long
-
iRetValue = sndPlaySound(CurrentProject.Path & "\Beepgunshot.wav", SND_ASYNC)
-
[Forms]![racef]![TimeSF]![timestart] = Format(Now, "dd/MM/yyyy HH:nn:ss") & "." & Right(Format(Timer, "#0.00"), 2)
there is a module involved for the wav file
The attached file is in v2003
got the delay right to the millisecond - Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and in the button code added this at right place to delay 8 1762 NeoPa 32,556
Expert Mod 16PB
I'm not familiar with the function sndPlaySound() but I think the clue is in the last parameter SND_ASYNC. You want the function to run synchronously of course.
got the delay right to the millisecond - Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and in the button code added this at right place to delay NeoPa 32,556
Expert Mod 16PB
Did you not find the list of allowable parameters for sndPlaySound()? I can see your solution is a good one, but if you use the function as (I expect) it is designed for this scenario, you wouldn't even have the problem to need a clever solution. I can't find anything about it as it's not an Access function at all, but you must have it available in order to use it.
PS. The approach you use is open to failure if anything delays the processing of the sound. This may not be a big problem in your project, but surely less appropriate than running the sound synchronously in the first place.
Thx NeoPa. I searched the internet for your solution but could not find anything. Then came across this other solution. It seems to work fine for now.
NeoPa 32,556
Expert Mod 16PB
I'm not sure why you'd search the internet for it when you must have the library to hand anyway in order to use it, but that's by-the-by I suppose. If you're happy with that then who am I to worry.
Neopa i am still a beginner but learning fast. This project of mine has taught me so much already, and i am very great full to you and Adezi and others that regularly helped me so much in he last few months.My timing program is working brilliantly now and if you ever have people needing info on timing races, refer them to me by all means.
Neels
For the record, NeoPa had the solution in Post #2, where he suggested that you execute the Sound File Synchronously. The syntax is: - Public Const SND_SYNC = &H0
- Dim iRetValue As Long
-
-
iRetValue = sndPlaySound("C:\Test\Test.wav", SND_SYNC)
-
-
'You will not see this Message Box until Test.wav has finished playing
-
MsgBox "Sound completed!"
P.S. - I feel as though this is a much cleaner and more efficient approach.
NeoPa 32,556
Expert Mod 16PB
To be fair, missing the proper solution is often a cause of learning more about other areas and aspects. Neels has got some good experience of using delays and timers etc, even if this is not an appropriate place to use it.
PS. Thanks for the post ADezii.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dave |
last post by:
Hi,
This way to start a function works with IE; why doesn't it work with NS (7).
<input type="button" id="test">
<script>
function test.onclick()
{
....
}
|
by: Laurence Nuttall |
last post by:
I have noticed that in .Net when I run the program,
It moves the start button to the second row,
How can I have it keep the start button on the first row.
Thanks,
Laurence Nuttall
Programmer...
|
by: Kim Würtz |
last post by:
Hi everybody
I have a mission critical application, so I don't
want the user to be able to start other apps on the
PC like internet explorer etc.
Therefore I want to hide the start button as...
|
by: news.microsoft.com |
last post by:
I'm trying to write a program that will lock down the system. I want to
hide the start button and taskbar. I found code using ShowWindow &
FindWindow but they fail to work.
Butttonhwnd =...
|
by: [Yosi] |
last post by:
I search solution for a little bit strange problem , I working on an
application which includes a button.
Click on this button will create number of threads each one execute deferent
executable...
|
by: Magic Gooddy |
last post by:
Hi!
How to hide Start Button in VB.NET?
I know in VB6 and want to see this sample in VB.NET.
Can anybody create worked sample?
|
by: Tee |
last post by:
Hi,
Can we use thread.start on a function that has return value?
I have a function that will take sometimes to run and it will return a
string value, and I want to use thread.start to call...
|
by: chris311976 |
last post by:
I have a laptop it boots normally to xp i chose a user the windows desktop comes up with no start button icons or anything.I tried to go into safe mode etc but nothing works help!
|
by: thupham |
last post by:
Dear all friend,
I want disable Ctl+Alt+Del; Ctrl+Esc; Ctrl+tab, Alt+Tab, Start button, ctrl+Alt+Del, lock all keys on the keyboard. Have you ever do it in C#.
Help me.
Thanks for all reply.
|
by: visweswaran2830 |
last post by:
I want to disable start button and alt+tab button using vb.net. Can any one help me. I tried with below coding but not success
Option Explicit
Private Declare Function EnableWindow Lib...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |