Calendar

This is a discussion on Calendar within the C++ Programming forums, part of the General Programming Boards category; I am fairly new to C/C++. I was wondering if it was possible to access the calendar that is provided ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    9

    Calendar

    I am fairly new to C/C++. I was wondering if it was possible to access the calendar that is provided by windows in application. Can it be done by some library call?

    If possible, can I integrate it with one of my Java application via the JNI...

    Thank you.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Not quite clear what you want to access? The time/date functionality of the Windows OS or if you want to "access" some application that is supplied as part of the whole windows distribution.

    Please explain what you want to do in a bit more detail, and I'm sure someone will be able to help you.

    --
    Mats

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    9

    RE

    Well, I've seen some applications that have a calendar that is identical to the the one one Microsoft windows (double click on the time and it will pop up). I'm wondering this available via some function call in C++ or C.

    Hope its clearer.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Well, the "timedate" control panel that you get from double-clicking on the time at the lower left (assuming usual Western layout) of the screen is run by "rundll32.exe".

    I think it's possible to load a control panel element from another application, but I don't know how you do that, and I honestly can't be bothered to google for it right now.

    --
    Mats

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    9
    I ran that command in the run box, but nothing happened.

    But, even if I can execute the command via run would it be possible to get the date that the user selects (Month & Day)? Or do I have to build my own calendar?

    Would building my own calendar just be easier?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The control panel isn't for selecting a date, it is for CHANGING the current date in the machine.

    To select a date, you probably have to write your own (or find something that someone else wrote that will do the job).

    Note that date/time calculations aren't real trivial when you start looking at more than a year or so ahead/back. Consider for example that the "is_leapyear = (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0));" [I think I got that right, in text it is: A year divisible by 4 (e.g. 1984), not evenly divisible by 100 (e.g 1900 is NOT a leapyear), except if it's evenly divisible by 400 (e.g. 2000 is a leapyear - not happening again for 400 years tho that a leapyear ends in '00').

    There are ready-made libraries for date-calculations (days between two dates, which day of week it is, etc, etc). Someone suggested "Boost" (spelling?) for this earlier. I have never used that one (I wrote a lot of date/time-calculations some 15 years ago or so, but I haven't done any of it in the last few years).

    I'm fairly sure there is "graphical calender" available too somewhere on the web - just make sure you can comply with the license if this is for commercial development work.

    --
    Mats

  7. #7
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    If you are looking for an interesting way to calculate dates on a calander, you might find the Doomsday algorithm interesting http://rudy.ca/doomsday.html.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a program to make a calendar
    By Northstar in forum C Programming
    Replies: 17
    Last Post: 11-07-2007, 11:34 AM
  2. how to convert from solar calendar to lunar calendar??
    By zaracattle in forum C++ Programming
    Replies: 7
    Last Post: 11-30-2006, 07:17 AM
  3. calendar program for linux
    By *ClownPimp* in forum Tech Board
    Replies: 1
    Last Post: 10-01-2005, 03:31 AM
  4. Calendar Program. What am I doing wrong?
    By Sektor in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2004, 11:39 PM
  5. writing a calendar program help please!!!
    By Newbie2006 in forum C Programming
    Replies: 7
    Last Post: 11-20-2002, 07:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21