-
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.
-
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
-
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.
-
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
-
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?
-
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
-
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.