473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Armin - Start sound problem revived in new thread

Armin,
Renewing my request for help to have a different Windows Start Sound for
each day of the week.

I have started again completely. Opened a new project called Windows
Application 1 and immediately selected the menu View/Code and entered the
text amended as suggested so that
Form 1.vb* now reads:
Public Class Form1

Private Declare Function sndPlaySound Lib

"winmm.dll" Alias _

"sndPlaySoundA" (ByVal FileName As String, _

ByVal Flags As Integer) As Boolean

Private Sub Form1_Load( _

ByVal sender As System.Object, _

ByVal e As System.EventArgs) _

Handles MyBase.Load

Dim day As Integer

Dim filename As String

day = Weekday(Now, FirstDayOfWeek.System)

filename = "C:\start sound\day" & day & ".wav"

Msgbox(sndPlaySound(filename, 1))

End Sub

End Class

At the foot now there is an error list with 2 errors. The first at line 2
Col 41 reads "String constant expected" and the second at line4 col 1 reads
"Syntax error".

The section at the right headed Data Sources records that my project
currently has no data sources associated and invites me to add New Data
Source and "data bind items etc"
I really feel out of my depth. I'm happy to press on but will be totally
reliant on help if you remain happy to assist.
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk
Jan 3 '06 #1
11 1149
Armin
Further to your last message on the previous thread, I was aware that an
"exe"or "com" file might be needed, but there was none to be found so
obviously I had not taken whatever action is required to create it. I doubt
its any different now with my latest endeavour. I do not know what you mean
by IDE.
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk
"Jack Sadie" <ja*******@btinternet.com> wrote in message
news:9a********************@pipex.net...
Armin,
Renewing my request for help to have a different Windows Start Sound for
each day of the week.

I have started again completely. Opened a new project called Windows
Application 1 and immediately selected the menu View/Code and entered the
text amended as suggested so that
Form 1.vb* now reads:
Public Class Form1

Private Declare Function sndPlaySound Lib

"winmm.dll" Alias _

"sndPlaySoundA" (ByVal FileName As String, _

ByVal Flags As Integer) As Boolean

Private Sub Form1_Load( _

ByVal sender As System.Object, _

ByVal e As System.EventArgs) _

Handles MyBase.Load

Dim day As Integer

Dim filename As String

day = Weekday(Now, FirstDayOfWeek.System)

filename = "C:\start sound\day" & day & ".wav"

Msgbox(sndPlaySound(filename, 1))

End Sub

End Class

At the foot now there is an error list with 2 errors. The first at line 2
Col 41 reads "String constant expected" and the second at line4 col 1
reads "Syntax error".

The section at the right headed Data Sources records that my project
currently has no data sources associated and invites me to add New Data
Source and "data bind items etc"
I really feel out of my depth. I'm happy to press on but will be totally
reliant on help if you remain happy to assist.
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk

Jan 3 '06 #2
"Jack Sadie" <ja*******@btinternet.com> schrieb
Armin,
Renewing my request for help to have a different Windows Start Sound
for each day of the week.

I have started again completely. Opened a new project called Windows
Application 1 and immediately selected the menu View/Code and
entered the text amended as suggested so that
Form 1.vb* now reads:

I don't know how the code looks in your Form1.vb because if you paste it
here it is changed. This should work:

Private Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal FileName As String, _
ByVal Flags As Integer) As Boolean

Private Sub Form1_Load( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load

Dim day As Integer
Dim filename As String
day = Weekday(Now, FirstDayOfWeek.System)
filename = "C:\start sound\day" & day & ".wav"
MsgBox(sndPlaySound(filename, 1))
End Sub
As I've written in the other thread (I believe I did), I hope you did not
delete the "Windows Forms Designer generated Code" region.

BTW, you should keep answering in the thread you've already started because
otherwise I have to search for it and other people don't know what we are
talking about.
End Sub

Jan 4 '06 #3
"Jack Sadie" <ja*******@btinternet.com> schrieb
Armin
Further to your last message on the previous thread, I was aware
that an "exe"or "com" file might be needed, but there was none to be
found so obviously I had not taken whatever action is required to
create it. I doubt its any different now with my latest endeavour.
There is a menu Build -> Build project. After that, you should have an exe
file in the 'bin' subfolder of your project.
I do not know what you mean by IDE.


Integrated Development Environment. The thing with the windows and menus
that you use for development. ;-)
Armin
Jan 4 '06 #4
OK !! we're really getting somewhere at last.
Found the .exe file in a subdirectory of .bin and put in start-up folder.
Rebooted and lo and behold! The music she played - correct day too.
Checked that too by re-setting the date and re-booting. Same again
correct music for day selected.
Many thanks are due to you for all that.
However there are still a couple of issues - some people are never satisfied
eh!

1. When the music starts, a dialog flashes on to screen headed Windows
Application1
(which is the name of course) and message reads "True" with an "OK" button
below.
When I press the OK button a new dialog opens which is blank except for the
heading
"Form1" and I can close that with the top right hand "close" button in the
usual way.
I'd like to get rid of all the dialogs if possible - don't mind if they show
briefly but I
don't want to have to delete them manually.

2. The music starts very late in the boot sequence - about 120 seconds after
pressing the re-boot switch as opposed to about 40 seconds with a sound set
via the "Sounds and Audio Devices" icon in Control Panel. Clearly the method
you have used for setting my sounds does not select a sound which is
inserted via the last mentioned. Is it possible to determine the place of
that exe file in the boot sequence? I have the StartupCop program but I
think that merely shows what's present and allows it to be enabled or
disabled.

Anyway so far so good. My grateful thanks.
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ev****************@TK2MSFTNGP11.phx.gbl...
"Jack Sadie" <ja*******@btinternet.com> schrieb
Armin,
Renewing my request for help to have a different Windows Start Sound
for each day of the week.

I have started again completely. Opened a new project called Windows
Application 1 and immediately selected the menu View/Code and
entered the text amended as suggested so that
Form 1.vb* now reads:

I don't know how the code looks in your Form1.vb because if you paste it
here it is changed. This should work:

Private Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal FileName As String, _
ByVal Flags As Integer) As Boolean

Private Sub Form1_Load( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load

Dim day As Integer
Dim filename As String
day = Weekday(Now, FirstDayOfWeek.System)
filename = "C:\start sound\day" & day & ".wav"
MsgBox(sndPlaySound(filename, 1))
End Sub
As I've written in the other thread (I believe I did), I hope you did not
delete the "Windows Forms Designer generated Code" region.

BTW, you should keep answering in the thread you've already started
because otherwise I have to search for it and other people don't know what
we are talking about.
End Sub

Jan 4 '06 #5
"Jack Sadie" <ja*******@btinternet.com> schrieb
OK !! we're really getting somewhere at last.
Found the .exe file in a subdirectory of .bin and put in start-up
folder. Rebooted and lo and behold! The music she played - correct
day too. Checked that too by re-setting the date and re-booting.
Same again correct music for day selected.
Many thanks are due to you for all that.
However there are still a couple of issues - some people are never
satisfied eh!

1. When the music starts, a dialog flashes on to screen headed
Windows Application1
(which is the name of course) and message reads "True" with an "OK"
button below.
When I press the OK button a new dialog opens which is blank except
for the heading
"Form1" and I can close that with the top right hand "close" button
in the usual way.
I'd like to get rid of all the dialogs if possible - don't mind if
they show briefly but I
don't want to have to delete them manually.
You remember that I inserted the msgbox to debug the problem. You can simply
remove it.

If you don't want a Form, you can reduce the application to Sub Main. That's
the sub that is called when the program starts. Add a class to the project
(e.g. named "App") and insert the sub main:

Shared Sub Main

End Sub

Move the code that you currently have in Form_Load into this sub. After
this, you can delete Form1.vb from the project. Afterwards, you will
probably get a message from VB that Sub main isn't found. Doubleclick on the
message in the task list and select App.Main as the new startup object. If
you don't get the message, open the project properties and set Sub Main
there.
2. The music starts very late in the boot sequence - about 120
seconds after pressing the re-boot switch as opposed to about 40
seconds with a sound set via the "Sounds and Audio Devices" icon in
Control Panel. Clearly the method you have used for setting my
sounds does not select a sound which is inserted via the last
mentioned. Is it possible to determine the place of that exe file in
the boot sequence? I have the StartupCop program but I think that
merely shows what's present and allows it to be enabled or disabled.


I don't know how you can influence the order of started applications at
startup.
Armin

Jan 4 '06 #6
Thanks. I'll try to follow your instructions on that and report back.
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk

"Armin Zingler" <az*******@freenet.de> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
"Jack Sadie" <ja*******@btinternet.com> schrieb
OK !! we're really getting somewhere at last.
Found the .exe file in a subdirectory of .bin and put in start-up
folder. Rebooted and lo and behold! The music she played - correct
day too. Checked that too by re-setting the date and re-booting.
Same again correct music for day selected.
Many thanks are due to you for all that.
However there are still a couple of issues - some people are never
satisfied eh!

1. When the music starts, a dialog flashes on to screen headed
Windows Application1
(which is the name of course) and message reads "True" with an "OK"
button below.
When I press the OK button a new dialog opens which is blank except
for the heading
"Form1" and I can close that with the top right hand "close" button
in the usual way.
I'd like to get rid of all the dialogs if possible - don't mind if
they show briefly but I
don't want to have to delete them manually.


You remember that I inserted the msgbox to debug the problem. You can
simply remove it.

If you don't want a Form, you can reduce the application to Sub Main.
That's the sub that is called when the program starts. Add a class to the
project (e.g. named "App") and insert the sub main:

Shared Sub Main

End Sub

Move the code that you currently have in Form_Load into this sub. After
this, you can delete Form1.vb from the project. Afterwards, you will
probably get a message from VB that Sub main isn't found. Doubleclick on
the message in the task list and select App.Main as the new startup
object. If you don't get the message, open the project properties and set
Sub Main there.
2. The music starts very late in the boot sequence - about 120
seconds after pressing the re-boot switch as opposed to about 40
seconds with a sound set via the "Sounds and Audio Devices" icon in
Control Panel. Clearly the method you have used for setting my
sounds does not select a sound which is inserted via the last
mentioned. Is it possible to determine the place of that exe file in
the boot sequence? I have the StartupCop program but I think that
merely shows what's present and allows it to be enabled or disabled.


I don't know how you can influence the order of started applications at
startup.
Armin

Jan 5 '06 #7
So sorry - now down with 'flu.
Just got up to let you know I haven't given up yet.
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk
"Armin Zingler" <az*******@freenet.de> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
"Jack Sadie" <ja*******@btinternet.com> schrieb
OK !! we're really getting somewhere at last.
Found the .exe file in a subdirectory of .bin and put in start-up
folder. Rebooted and lo and behold! The music she played - correct
day too. Checked that too by re-setting the date and re-booting.
Same again correct music for day selected.
Many thanks are due to you for all that.
However there are still a couple of issues - some people are never
satisfied eh!

1. When the music starts, a dialog flashes on to screen headed
Windows Application1
(which is the name of course) and message reads "True" with an "OK"
button below.
When I press the OK button a new dialog opens which is blank except
for the heading
"Form1" and I can close that with the top right hand "close" button
in the usual way.
I'd like to get rid of all the dialogs if possible - don't mind if
they show briefly but I
don't want to have to delete them manually.


You remember that I inserted the msgbox to debug the problem. You can
simply remove it.

If you don't want a Form, you can reduce the application to Sub Main.
That's the sub that is called when the program starts. Add a class to the
project (e.g. named "App") and insert the sub main:

Shared Sub Main

End Sub

Move the code that you currently have in Form_Load into this sub. After
this, you can delete Form1.vb from the project. Afterwards, you will
probably get a message from VB that Sub main isn't found. Doubleclick on
the message in the task list and select App.Main as the new startup
object. If you don't get the message, open the project properties and set
Sub Main there.
2. The music starts very late in the boot sequence - about 120
seconds after pressing the re-boot switch as opposed to about 40
seconds with a sound set via the "Sounds and Audio Devices" icon in
Control Panel. Clearly the method you have used for setting my
sounds does not select a sound which is inserted via the last
mentioned. Is it possible to determine the place of that exe file in
the boot sequence? I have the StartupCop program but I think that
merely shows what's present and allows it to be enabled or disabled.


I don't know how you can influence the order of started applications at
startup.
Armin

Jan 6 '06 #8
"Jack Sadie" <ja*******@btinternet.com> schrieb
So sorry - now down with 'flu.
Just got up to let you know I haven't given up yet.


Oh. :-( Get well soon!
Armin
Jan 8 '06 #9
Armin, Back again and thanks for your good wishes.

During my sickness I did a lot of thinking about what I'm trying to achieve
and believe there may be a MUCH better approach if you remain interested.
In order to get the timing right, it makes sense to use the Windows control
panel to set the start sound.
Therefore what I'd like to design is a routine which can be set in the start
up folder and which will:-

1. Delete FilenameX in Filepath\FolderB
2. If the day is Monday, copy File1 from Filepath\FolderA to
Filepath\FolderB with the new name FilenameX, or
3. If the day is Tuesday, copy File2 from Filepath\FolderA to
Filepath\FolderB with the new name FilenameX, or..........
4. ........etc for each day of the week.

In that way the file will be changed daily, ready for the next day's
startup, and it does not matter at what stage in the boot sequence it is
executed. I expect it will execute after that day's sound has been invoked,
but it would not really matter if it executed earlier.

Does that make sense ?
TIA =:>)~ (~ is because I have a beard!)
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
"Jack Sadie" <ja*******@btinternet.com> schrieb
So sorry - now down with 'flu.
Just got up to let you know I haven't given up yet.


Oh. :-( Get well soon!
Armin

Jan 11 '06 #10
"Jack Sadie" <ja*******@btinternet.com> schrieb
Armin, Back again and thanks for your good wishes.
I hope you feel better now. :-)
During my sickness I did a lot of thinking about what I'm trying to
achieve and believe there may be a MUCH better approach if you
remain interested. In order to get the timing right, it makes sense
to use the Windows control panel to set the start sound.
Therefore what I'd like to design is a routine which can be set in
the start up folder and which will:-

1. Delete FilenameX in Filepath\FolderB
2. If the day is Monday, copy File1 from Filepath\FolderA to
Filepath\FolderB with the new name FilenameX, or
3. If the day is Tuesday, copy File2 from Filepath\FolderA to
Filepath\FolderB with the new name FilenameX, or..........
4. ........etc for each day of the week.

In that way the file will be changed daily, ready for the next day's
startup, and it does not matter at what stage in the boot sequence
it is executed. I expect it will execute after that day's sound has
been invoked, but it would not really matter if it executed earlier.

Does that make sense ?
Not to me. Sorry. :-) You are saying "next day's startup" - what if it's
started 3 days later? Wrong sound. I think the way you did it before is much
more straightforward: Play the sound for the day when it's started.

TIA =:>)~ (~ is because I have a beard!)


From today I don't have one anymore. :) (but I do have a nose ;o)
Armin

Jan 11 '06 #11
Ok., Armin.

Well thanks to you that works now already, except I need to delete the Form.
And
hopefully I should be able to achieve that by myself now.
Thanks for having stayed with me. {:>)~
--
Regards, Jack Sadie
ja************@yahooREMOVE.co.uk
"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Jack Sadie" <ja*******@btinternet.com> schrieb
Armin, Back again and thanks for your good wishes.


I hope you feel better now. :-)
During my sickness I did a lot of thinking about what I'm trying to
achieve and believe there may be a MUCH better approach if you
remain interested. In order to get the timing right, it makes sense
to use the Windows control panel to set the start sound.
Therefore what I'd like to design is a routine which can be set in
the start up folder and which will:-

1. Delete FilenameX in Filepath\FolderB
2. If the day is Monday, copy File1 from Filepath\FolderA to
Filepath\FolderB with the new name FilenameX, or
3. If the day is Tuesday, copy File2 from Filepath\FolderA to
Filepath\FolderB with the new name FilenameX, or..........
4. ........etc for each day of the week.

In that way the file will be changed daily, ready for the next day's
startup, and it does not matter at what stage in the boot sequence
it is executed. I expect it will execute after that day's sound has
been invoked, but it would not really matter if it executed earlier.

Does that make sense ?


Not to me. Sorry. :-) You are saying "next day's startup" - what if it's
started 3 days later? Wrong sound. I think the way you did it before is
much more straightforward: Play the sound for the day when it's started.

TIA =:>)~ (~ is because I have a beard!)


From today I don't have one anymore. :) (but I do have a nose ;o)
Armin

Jan 11 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andrew Poulos | last post by:
As a follow on to the 'fun' I had with IE I'm now trying to play sounds using an Object tag (no Embed) in MZ. Sadly whenever 'playButton' gets clicked MZ says that "audObj.Play is not a function":...
10
by: Jack Sadie | last post by:
I am using Windows XP and I have found out how to substitute my own wav sound for the Microsoft default sound when my computer starts, but now I want to go a step further. I have created 7...
37
by: ales | last post by:
Hello, I have a problem with creation of new thread. The method .Start() of newly created thread delays current thread for 0 - 1 second. Cpu while delay occurs is about 5%. Any idea? Here...
17
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
4
by: gazza67 | last post by:
Hi, Does anyone know how to check for when a sound has finished playing? I am currently using the SoundPlayer, there doesnt seem to be any event for this - am I missing something? Gary
0
by: Yue Fei | last post by:
I have a multi thread python code, threads can start immediately if I run on command line, but I can get them started right the way if I call the same code from C/C++. test code like this: from...
3
by: Jack | last post by:
Hi, I'm writing a simple wav player (like winamp) and using the SoundPlayer class in c# 2005. Using winform buttons, I can begin playing the sound and stop half-way through the sound using:...
9
by: =?Utf-8?B?anVhbg==?= | last post by:
How can I do to start a thread. I tried everything... but it had no work. Any solution? It is a Sub working with a Timer control. I want to do two tasks at the same time (more or less for a...
1
by: desturrr | last post by:
Hello all, I have small sized mp3 files that i can play via Java using JLayerPlayer that takes the address of mp3 files , JLayerPlayer objects can be played creating threads and starting. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.