Mini Alarm System
I was wondering if it would be possible to create a program that has a box on the screen and a clock. if the mouse cursor is not over the box at a set time the alarm will go off or if the mouse cursor goes out of the box during a certian time slot an alarm will go off again.
Is this possible to make and is it difficult to do and i am thinking of creating something like this is it is possible?
If it is any pointers and advice would be greatful
Thanks in advance
Actually that should be relatively easy to do.
Use the windows time functions, and check for mouse focus in the window or one of it child windows. As for the clock, it depends. If you want it to look digital that would be easy, but if you want the generic rotating clock i have no idea.
yeah i am just after a digital clock nothing too difficult as it is just going to be an example but not too sure where to start or how to get going with it.
at the moment i have some coding that shows the mouse co-ordinates just need to get it to recognise that there is a box there etc
Windows should sent WM_MOUSEMOVE or the like messages when the mouse is over your window, so that bit is easy.
As for time, well just count in seconds. The best (and easiest) way is to use a timer. Set it to one second and call a callback function that decreases the count by one. If it's zero, check a flag if the mouse is over the box or such and set off alarm, if appropriate.
Get the mouse coords on a mouse move event.
Get the dialogs position (GetWindowRect)
Convert both to screen / client (ClientToScreen or ScreenToClient)
Test if mouse point is in dialog rect (PtInRect)
PlaySound() as required.