Thread: Mini Alarm System

  1. #1
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215

    Mini Alarm System

    Hi

    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

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    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.

  3. #3
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    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

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    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.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using system icons
    By @nthony in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2007, 07:56 PM
  2. Printing System time and 30 minute alarm
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-17-2006, 05:10 AM
  3. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  4. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM
  5. Problem Reporting System. Need Advide!
    By brunomiranda in forum Tech Board
    Replies: 9
    Last Post: 09-25-2003, 09:21 PM