Home All Groups Group Topic Archive Search About

Armin - Start sound problem revived in new thread

Author
3 Jan 2006 6:53 PM
Jack Sadie
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
jaxalad-buy***@yahooREMOVE.co.uk

Author
4 Jan 2006 12:59 AM
Armin Zingler
"Jack Sadie" <jacksa***@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
Author
4 Jan 2006 4:01 PM
Jack Sadie
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
jaxalad-buy***@yahooREMOVE.co.uk

Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:evy%23JrMEGHA.1032@TK2MSFTNGP11.phx.gbl...
> "Jack Sadie" <jacksa***@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
>
Author
4 Jan 2006 5:53 PM
Armin Zingler
Show quote Hide quote
"Jack Sadie" <jacksa***@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
Author
6 Jan 2006 7:31 PM
Jack Sadie
So sorry - now down with 'flu.
Just got up to let you know I haven't given up yet.
--
Regards, Jack Sadie
jaxalad-buy***@yahooREMOVE.co.uk
Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:uaFvqlVEGHA.2912@tk2msftngp13.phx.gbl...
> "Jack Sadie" <jacksa***@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
Author
8 Jan 2006 10:34 AM
Armin Zingler
"Jack Sadie" <jacksa***@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
Author
11 Jan 2006 9:43 AM
Jack Sadie
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
jaxalad-buy***@yahooREMOVE.co.uk
Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:uJpayBEFGHA.1424@TK2MSFTNGP12.phx.gbl...
> "Jack Sadie" <jacksa***@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
Author
11 Jan 2006 10:03 AM
Armin Zingler
"Jack Sadie" <jacksa***@btinternet.com> schrieb
> Armin, Back again and thanks for your good wishes.

I hope you feel better now. :-)

Show quoteHide quote
> 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
Author
11 Jan 2006 10:02 PM
Jack Sadie
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
jaxalad-buy***@yahooREMOVE.co.uk
Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:%23R9zyfpFGHA.3912@TK2MSFTNGP10.phx.gbl...
> "Jack Sadie" <jacksa***@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