flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Alarm - System tray clock / reminder [DONE]

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 11 Apr 2006, 07:24
I have been looking alarm clock/reminder that stays on system tray,
but not found any good/small/easy to use.
Only thing to do was write it.

Notes:
- Alarm.ini is loaded when program is started and saved after every change
In [Alarms] section line format is:
Alarm001=hh:mm dd.mm.yyyy msg
Sound001=c:\fasmw\alarm\alarm.mp3
char between time and date is repeat interval
(space = none,
d = daily, w = weekly, m = monthly, y = yearly,
D = weekdays, E = weekends,
t = 2 weeks, f = 4 weeks, s = 6 weeks, e = 8 weeks)
- on exit show warning if there is alarms left
- maximum 100 different alarms in chronological order
- maximum length of user message is 79 character
- repeat alarm sound in 1 min intervals in next 10 minutes
- you can modify your countrys bank holidays in setup window (format: dd.mm dd.mm dd.mm)
used only by weekdays/weekends repeat intervals
- to load at startup, use checkbox in setup window.
remember uncheck it before you delete program

edit1: ordered alarm list,ini handling rewritten,choice sound,date picker
edit2: LogFile,added daily/weekly/monthly/yearly/weekdays/weekend repeat
edit3: added 2/4/6/8 weeks repeat,edit_dialog,next alarm in tray tooltip
edit4: MP3 support,holidays list,setup dialog,window sizing
edit5: save window pos/size,some tooltips,listbox colors
edit6: added handler for TaskbarCreated,sound test
edit7: write2log,MB_TOPMOST,choose colors,day of week,tabstops in ownerdrawn listbox
edit8: FindWindow,show same day alarms in edit dialog,confirm when delete alarm


Description: Alarm screenshot
Filesize: 15.92 KB
Viewed: 25338 Time(s)

Alarm012ss.png


Description: Alarm v0.12
Download
Filename: Alarm012.zip
Filesize: 40.44 KB
Downloaded: 1049 Time(s)



Last edited by ATV on 27 Aug 2007, 07:14; edited 10 times in total
Post 11 Apr 2006, 07:24
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner 11 Apr 2006, 12:38
i suggest a choice of
"beeping" the system using mb speaker
or using the .wav file.

and user could set like, keep sounding until a button is pressed or watever. (like handphone alarm)
Post 11 Apr 2006, 12:38
View user's profile Send private message Visit poster's website Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM 11 Apr 2006, 21:14
here's some code to add/remove the program from the local machine startup: (i tested the add section, dunno about the remove part)
Code:
;put this in data section
SubKey db 'Alarm',0
RegRunKey db 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run',0
CurrentProgram db '"'
ProgramName rb 514
;put this in code section
add_startup:
invoke  GetModuleFileName,NULL,ProgramName,512 ;get the file name
test    eax,eax
jz      .die;can't get name???
mov     word [ProgramName+eax],'"' ;make sure it is enclosed in quotes in case of spaces
lea     esi,[eax+3]   ;total length
sub     esp,4
invoke  RegOpenKeyEx,HKEY_LOCAL_MACHINE,RegRunKey,0,KEY_WRITE,esp ;change HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER if necessary
pop     ebx
test    eax,eax
jnz     .die ;error
invoke  RegSetValueEx,ebx,SubKey,0,REG_SZ,CurrentProgram,esi
test    eax,eax
jnz     .die
invoke  RegCloseKey,ebx
ret
.die:
;error handling here.
ret
remove_startup:
sub     esp,4
invoke  RegOpenKeyEx,HKEY_LOCAL_MACHINE,RegRunKey,0,KEY_WRITE,esp ;change HKEY_LOCAL_MACHINE to HKEY_CURRENT_USER if necessary
pop     ebx
test    eax,eax
jnz     .die ;error
invoke  RegDeleteValue,ebx,SubKey
test    eax,eax
jnz     .die
invoke  RegCloseKey,ebx
ret
.die:
;error handling here.
ret
    

_________________
This calls for... Ultra CRUNCHY Man!
Ta da!! *crunch*
Post 11 Apr 2006, 21:14
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 12 Apr 2006, 12:53
UCM, thank you, thats just right code and remove works too.
Only problem was that it dont set work dir for data file, like shortcut in startup menu.
Just need copy of program path, not big deal.
Maybe i need think little more, before messing with win register.
If user just delete program, then run key is still there, and thats not good.

vbVeryBeginner, and maybe total silence too.

PS. I'll be back in next week, because here library are close whole Easter.
Post 12 Apr 2006, 12:53
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 18 Apr 2006, 07:19
Above attachment updated

New features in v0.02
- ordered alarm list
- ini handling rewritten
- choice sound (NoSound/Wav/Beep/Siren)
- date picker
Post 18 Apr 2006, 07:19
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 31 Jul 2006, 09:04
Above attachment updated

New features in v0.03
- save to LogFile
- counter for repeat sound
- added daily/weekly/monthly/yearly/weekdays/weekend repeat
Post 31 Jul 2006, 09:04
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 08 Sep 2006, 11:57
Above attachment updated

New features in v0.04
- added settopindex
- added 2/4/6/8 weeks repeat
- added edit_dialog
- next alarm in tray tooltip
Post 08 Sep 2006, 11:57
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 03 Oct 2006, 12:24
I have been testing MP3 support, what do you think is it good or bad thing.

This is only test version.

edit: Attachment removed


Last edited by ATV on 06 Oct 2006, 07:07; edited 1 time in total
Post 03 Oct 2006, 12:24
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 03 Oct 2006, 12:30
definitively good
Post 03 Oct 2006, 12:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 04 Oct 2006, 08:17
it will be good to add each mp3 melody to each remind.(not only one mp3 to all datas and times).
Post 04 Oct 2006, 08:17
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 04 Oct 2006, 10:10
dead_body, it will need to rewrite ini file handling. Something like:

alarm01=09:00y24.12.2006 Merry Christmas!
sound01=c:\mp3\Bing Crosby - White Christmas.mp3

but i will think about it.
Post 04 Oct 2006, 10:10
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 06 Oct 2006, 07:09
Every alarm with own sound effect or mp3 file.

Note: ini format has changed, it is not compatible with old version.
If you want use old alarm.ini close old alarm program Open alarm.ini with notepad and replace
"Alarm=" with "Alarm001=" next alarm with "Alarm002=" , "Alarm003=" , ...
Sound will use default settings

This is still test version
Post 06 Oct 2006, 07:09
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 13 Oct 2006, 09:09
Little bug that change mp3 filename when edit alarm, fixed.
+more speed when save alarm.ini
WritePrivateProfileString was slow when there is many alarms in list, now using WriteFile

edit: Attachment removed, now MP3 support is in first post


Last edited by ATV on 16 Jan 2007, 08:06; edited 1 time in total
Post 13 Oct 2006, 09:09
View user's profile Send private message Reply with quote
Karl20001



Joined: 10 Nov 2005
Posts: 11
Karl20001 14 Jan 2007, 16:16
Hi, i really like your tool, but it would be nice to have it go to tray when starting. I tried to add
invoke ShowWindow,[hWnd],SW_HIDE
mov [showflag],0
in .initdlg but the window is still staying.
Post 14 Jan 2007, 16:16
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 15 Jan 2007, 13:04
Hi Karl20001, That's good idea I like it. I try to find way to do it.
Currently I have been testing bank holidays list and window sizing, they are working, but need little cleaning. I also like it to check if program is already running, It works if I use CreateWindowEx and FindWindow, but I can't find old program if it's using dialogbox. So I have still lots of learning ahead.
Post 15 Jan 2007, 13:04
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 16 Jan 2007, 08:07
Hide window don't work in WM_INITDIALOG because it's called before window is shown.
Quick and dirty way to hide window at starting was setting extra timer that will be removed in first call. Maybe there is better way to do it, I just didn't find it.

Above attachment updated

New features in v0.08
- added holidays list
- setup dialog
- window sizing
Post 16 Jan 2007, 08:07
View user's profile Send private message Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 16 Jan 2007, 13:50
splendid
Post 16 Jan 2007, 13:50
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV 05 Feb 2007, 08:32
Above attachment updated

New features in v0.09
- save window pos/size into ini file
- some tooltips added
- listbox background colors, green for today and yellow for tomorrow
Post 05 Feb 2007, 08:32
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY 19 Apr 2007, 21:41
Shocked
I've got exactly this thing as homework!
But I have to do it in C! Sad

And yours in pure ASM looks better than mine trying to do GUI with GUI libraries.
/me gets pwned. Laughing

I hope I'll be able to read your code and learn things like minimize to tray, etc.
And then translate to C.
And I will really do it in pure C and Win32 API.
Post 19 Apr 2007, 21:41
View user's profile Send private message Reply with quote
pierre



Joined: 07 Nov 2004
Posts: 10
pierre 20 Apr 2007, 12:14
For a traybar app, you should also handle the TaskbarCreated event.
Otherwise your app won't be seen again if explorer.exe restarts.

Try it for yourself, launch your app and kill "explorer.exe" in the taskmanager. Alarm.exe will still be in memory but won't be accessible anymore.

Here under you'll find a slightly modified version of the tray.asm example.

--- tray_orig.asm
+++ tray.asm
@@ -21,6 +21,7 @@
section '.data' data readable writeable

szClass db "WNDCLASS", 0
+ szTaskBarCreated db "TaskbarCreated", 0
szTitle db "SysTray Example", 0
szShowHide db "&Show/Hide", 0
szExit db "&Exit", 0
@@ -28,6 +29,7 @@
hInstance dd ?
hTrayMenu dd ?
hMainWnd dd ?
+ wm_taskbarcreated dd ?
msg MSG
wc WNDCLASSEX
node NOTIFYICONDATA
@@ -37,6 +39,9 @@
; code section
section '.code' code readable executable
start:
+ invoke RegisterWindowMessageA, szTaskBarCreated
+ mov [wm_taskbarcreated], eax
+
invoke GetModuleHandle,0
mov [hInstance],eax

@@ -91,6 +96,8 @@
je .wmcreate
cmp eax,WM_DESTROY
je .wmdestroy
+ cmp eax,[wm_taskbarcreated]
+ je .wm_taskbarcreated
.defwndproc:
invoke DefWindowProc, [hWnd],[uMsg],[wparam],[lparam]
jmp .finish
@@ -162,6 +169,11 @@
invoke PostMessage, [hWnd],WM_NULL,0,0
jmp .finish

+ .wm_taskbarcreated:
+ ; When Explorer crashes and restarts.
+ invoke Shell_NotifyIcon, NIM_ADD, node ; show icon to system tray
+ jmp .finish
+
.wmdestroy:
invoke Shell_NotifyIcon, NIM_DELETE,node
invoke DestroyMenu, [hTrayMenu]


Description:
Download
Filename: tray.zip
Filesize: 3.13 KB
Downloaded: 852 Time(s)

Post 20 Apr 2007, 12:14
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.