Author Topic: a Digital Alarm Clock  (Read 2196 times)

zedd151

  • Member
  • **
  • Posts: 241
a Digital Alarm Clock
« on: September 24, 2015, 04:03:29 AM »
Here's another old project I found lurking on one of my hard drives.

A working digital alarm clock.

This program demonstrates several things:

1. sloppy coding style (and lack of comments) :biggrin: - sorry 'bout that.

2. Using two color text buttons.

3. Dynamically creating a Dialog box.

4. Putting the program icon into the system tray.

5. Processing right&left click messages from clicking the icon in the tray.

6. Playing MP3 sound.

7. Using Bitmaps to display the current time as well as alarm time.

8. Reading data from an ini file. (for alarm time setting and MP3 filename)

9. Using a custom cursor over the window

10. creating a custom window

11. Probably more, but due to the lack of commenting I'm not sure.

--------------------------------------------------------------------

This is one of my first "major" projects when I was first introduced
to masm32. Sorry for the sloppy code and overall bad programming
practices, but as a first 'big' project, I think it is one of the
few from that period that turned out fairly well.

If I get around to it I will clean up the code, try to decipher it
to properly comment at least the areas of interest (from the list
above)

Only one thing I should mention, when clicking the 'close' button
the alarm clock merely minimizes to the system tray. To completely
close the program, right click the icon in the tray. Left clicking
the icon restores the alarm clock.

The 'Stop Sound' button is not working, the only way to stop the sound is
to completely close the program with the method described in the above
paragraph. I haven't yet looked into it further.

To set the alarm time, edit the alarm.ini file.

You can also change the alarm sound by replacing the MP3 file, and
renaming it accordingly.

There is also an 'Easter Egg', but I forget where. You'll have to
find that yourself, or cheat and look in the code. (p.s., I found it)

zedd

I thought it might be useful, especially to the newcomers to the forum.

edit = typo
« Last Edit: September 25, 2015, 11:29:58 PM by zedd151 »
Links broken - to be remedied soon
----------------------------------------------
hutch: "MASM does not have bugs, it just has features you need to understand." 8)

Zen

  • Member
  • ****
  • Posts: 962
  • slightly red-shifted
Re: a Digital Alarm Clock
« Reply #1 on: September 24, 2015, 05:23:02 AM »
ZEDD151,
It works. And, it's useful. You know, comments aren't really necessary,...the code is quite clear.

I have found that if you include alot of ridiculously useless and trivial Comments, and code blocks that don't really do anything (and, that maybe execute conditionally) it increases the bloat factor to the point that nobody actually reads your code,...then you don't have to answer alot of really annoying questions in the aftermath,...
...It's probably my best talent as an assembly programmer,...:bgrin:
« Last Edit: September 24, 2015, 06:27:17 AM by Zen »
Zen

Siekmanski

  • Member
  • *****
  • Posts: 1145
Re: a Digital Alarm Clock
« Reply #2 on: September 24, 2015, 05:32:19 AM »
Nice alarm clock zedd

Zen

  • Member
  • ****
  • Posts: 962
  • slightly red-shifted
Re: a Digital Alarm Clock
« Reply #3 on: September 24, 2015, 06:35:12 AM »
ZEDD151, 
You could, of course, add a number of cool features to the basic Digital Alarm Clock,...
Zen

zedd151

  • Member
  • **
  • Posts: 241
Re: a Digital Alarm Clock
« Reply #4 on: September 24, 2015, 07:45:22 AM »
ZEDD151, 
You could, of course, add a number of cool features to the basic Digital Alarm Clock,...

I think it's fine the way it is. Plain, simple, utilitarian.

If anything, I would finish it properly. (The sound doesn't currently loop, can't stop sound manually...)

But as an example to do many of the things listed above, I think it fits the bill.

-- Siekmanski: Thanks for the compliment. When I coded it, I had absolutely no idea what I was
doing most of the time. I was simply following iczelions tutorials, the masm32 examples and others.
Then combining the little I knew then, into this little program.
Links broken - to be remedied soon
----------------------------------------------
hutch: "MASM does not have bugs, it just has features you need to understand." 8)

Mikl__

  • Member
  • ****
  • Posts: 555
Re: a Digital Alarm Clock
« Reply #5 on: September 24, 2015, 11:31:33 AM »
Hi, zedd151!
It's nice! And I liked the idea of copyright in the form of the cursor, so that no one stole the authorship of program

rrr314159

  • Member
  • *****
  • Posts: 1383
Re: a Digital Alarm Clock
« Reply #6 on: September 24, 2015, 01:02:12 PM »
Cool, zedd,

The strange thing is, the Stop Sound command works for me, altho you say it doesn't. I'm using Win 8.1 BTW.

The obvious feature to add would be ability to set the alarm time (via GUI not ini file) altho that would be fair amount of work of course.

Pretty easy improvements would be a help file, and displaying seconds. Another neat, easy extra would be ability to launch a user program (like Backup_Data, or Explode_Bomb, for instance 8) ) when alarm time is reached.

But no doubt there are better things to do ...
I am NaN ;)

zedd151

  • Member
  • **
  • Posts: 241
Re: a Digital Alarm Clock
« Reply #7 on: September 24, 2015, 01:17:22 PM »
The StopSound works for you?? That's odd. But this is a stripped down version of Windows XP, I used
nLite to reduce the overall size of the OS installation. But I do remember it did work at one point, I'll
have to investigate...

I had at one point wanted to enable changing the alarm time with the arrow keys on the keyboard,
I have another alarm clock that works that way. up/down to change alarm hour, left right to change
the minutes.

Funny thing you mentioned seconds. Originally it DID have a second display, but I removed it.
Help file was also originally intended as you can see by the button for it.

As for the other options you mentioned, they are all doable.

But as this is almost a two year old project, I can't see developing it further any time soon.

But eventually...maybe...

Oh yeah, I wanted to have the 'space bar' to be able to stop the sound as well.......................
Links broken - to be remedied soon
----------------------------------------------
hutch: "MASM does not have bugs, it just has features you need to understand." 8)