473,789 Members | 2,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 _

"sndPlaySou ndA" (ByVal FileName As String, _

ByVal Flags As Integer) As Boolean

Private Sub Form1_Load( _

ByVal sender As System.Object, _

ByVal e As System.EventArg s) _

Handles MyBase.Load

Dim day As Integer

Dim filename As String

day = Weekday(Now, FirstDayOfWeek. System)

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

Msgbox(sndPlayS ound(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 1176
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*******@btin ternet.com> wrote in message
news:9a******** ************@pi pex.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 _

"sndPlaySou ndA" (ByVal FileName As String, _

ByVal Flags As Integer) As Boolean

Private Sub Form1_Load( _

ByVal sender As System.Object, _

ByVal e As System.EventArg s) _

Handles MyBase.Load

Dim day As Integer

Dim filename As String

day = Weekday(Now, FirstDayOfWeek. System)

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

Msgbox(sndPlayS ound(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*******@btin ternet.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 _
"sndPlaySou ndA" (ByVal FileName As String, _
ByVal Flags As Integer) As Boolean

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

Dim day As Integer
Dim filename As String
day = Weekday(Now, FirstDayOfWeek. System)
filename = "C:\start sound\day" & day & ".wav"
MsgBox(sndPlayS ound(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*******@btin ternet.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*******@free net.de> wrote in message
news:ev******** ********@TK2MSF TNGP11.phx.gbl. ..
"Jack Sadie" <ja*******@btin ternet.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 _
"sndPlaySou ndA" (ByVal FileName As String, _
ByVal Flags As Integer) As Boolean

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

Dim day As Integer
Dim filename As String
day = Weekday(Now, FirstDayOfWeek. System)
filename = "C:\start sound\day" & day & ".wav"
MsgBox(sndPlayS ound(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*******@btin ternet.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*******@free net.de> wrote in message
news:ua******** ******@tk2msftn gp13.phx.gbl...
"Jack Sadie" <ja*******@btin ternet.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*******@free net.de> wrote in message
news:ua******** ******@tk2msftn gp13.phx.gbl...
"Jack Sadie" <ja*******@btin ternet.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*******@btin ternet.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\Folder B
2. If the day is Monday, copy File1 from Filepath\Folder A to
Filepath\Folder B with the new name FilenameX, or
3. If the day is Tuesday, copy File2 from Filepath\Folder A to
Filepath\Folder B 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*******@free net.de> wrote in message
news:uJ******** ******@TK2MSFTN GP12.phx.gbl...
"Jack Sadie" <ja*******@btin ternet.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

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

Similar topics

6
4058
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": window.onload = function() { var audObj = document.createElement("object"); audObj.setAttribute("id", "objmedia"); audObj.setAttribute("type","audio/x-aiff"); audObj.setAttribute("data","media/aif_sample.aif");
10
1204
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 different wave files (C:\Start sound\day1.wav to C:\Start sound\day7.wav respectively) and want to have a different one open according to the day of the week - the "day1.wav" opening on Mondays and the "day2.wav" on Tuesdays and so on. I have...
37
8910
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 is code used for measuring:
17
6445
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
1693
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
1528
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 threading import Thread import thread class testThread(Thread): def __init__ (self, id): Thread.__init__(self) self.id = id def run(self):
3
7839
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: myPlayer.Play() and myPlayer.Stop() methods which works great, but i want to know when the sound actually stops playing (so I can change my button's picture). If I raise a custom event after the myPlayer.Play()
9
1426
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 minute). Visual Basic 2005. Thanks.
1
2480
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 problem is when i have for example 9 sounds and i want it them to play in consecutively , so i put them in for loop like: for(int i=1;i<mainNotaList.size()+1;i++) { neyBox1.arrangeNeyImage(mainNotaList.get(i-1)); ...
0
10404
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.