Here's a calendar control for you guys. It's fairly fast written as I needed it for another project. Differences between the Windows Calendar control & this one are:

- You can highlight items (marking) on RightClick.

Oh - before I forget. As usual I split it into a hundred files. (A template I'm using) The files you'd be interested in will be:

WndProc to see how I create the Calendar
JCCalendar.asm the Calendar control in one file, including data, data?, constants, procs etc...

Find it attached to the thread over here
Posted on 2003-11-03 11:28:23 by JimmyClif
Looks all black on Windows 2000, the only things visible are the headings, and the green, blue and red coloured squares, everything else is black!

Posted on 2003-11-03 11:36:25 by Nick
Here's also a picture of it ;)
Posted on 2003-11-03 11:39:08 by JimmyClif
Mind posting a picture Nick ? TIA
Posted on 2003-11-03 11:43:34 by JimmyClif
Not sure whether this has attached a picture or not!

Posted on 2003-11-03 12:11:24 by Nick
I wonder if the to CreateSolidBrush getting the cal.hBrushBackGround fails on 2K. (Weird that all the other ones work)
Or if the FillRect which clears the screen won't do the job. (hard to believe)


Well if you wouldn't mind - could you replace and recompile after following change:

In JCCalendar::

Pretty much all the way at the bottom, in it's WndProc under WM_CREATE::

invoke CreateSolidBrush,-1 ;White
mov cal.hBrushBackGround,eax
invoke CreateSolidBrush,000500C8h ;Red
mov cal.hBrushMarked,eax
invoke CreateSolidBrush,00BCBCBCh ;Grey
mov cal.hBrushHeader,eax


[i];invoke CreateSolidBrush,-1 ;White
;mov cal.hBrushBackGround,eax[/i]
invoke CreateSolidBrush,000500C8h ;Red
mov cal.hBrushMarked,eax
invoke CreateSolidBrush,00BCBCBCh ;Grey
mov cal.hBrushHeader,eax
[i]mov cal.hBrushBackGround,eax[/i]

I just don't know what else it could be at the moment :confused:
...and even tho that I have Win2K lying on a disk somewhere I just can't install it as backing up all important data from the PC would take ages :-/
Posted on 2003-11-03 12:33:51 by JimmyClif
Either removing the 2 lines you, or setting the brush to be 00FFFFFFh instead work ok on Windows 2000.

Posted on 2003-11-04 03:54:17 by Nick
Originally posted by JimmyClif
invoke CreateSolidBrush,-1 ;White

not -1 is not white, well not "opaque white":
0xFFFFFFFF - note the "alpha bits", full transparentcy.
0x00FFFFFF - whie, no alpha transparency.

so eihter write (-1 and 0x00FFFFFF) or (0x00FFFFFF), the second is my recomendation.

IIRC Win2k+ uses the alpha bits somtimes, sometimes if needs them to be 0 (look at the color ref definition in win32.hlp), while win9x doesn't care.
Posted on 2003-11-04 07:13:43 by scientica
Alright, here's the corrected version :
Posted on 2003-11-05 20:10:41 by JimmyClif
Hi, I've taken what JimmyClif produced and have re-written this control for my own needs, hope nobody objects?
It is strongly based on work by JimmyClif, I'd just like to acknowledge that :)
Anyway, a demo and the source is attatched. I've only been able to test in on WinXP.

This control is more like an event diary, so the differences between this control and windows calendar control are:

    [*]Control resizes itself to fill the window.
    [*]Events can be indicated in a cell/day.
    [*]Double clicking a cell/day containing an event notifies the owner window - so the owner can display event details.
    [*]Left or right clicks highlight a cell/day.
    [*]Colours are almost completely customisable on the fly.

    There are a few other things that the demo might demonstrate. I think it's quite clear. The control holds the data ( how many events are on a certain date etc) in a linked list.

    It's a bit rushed so no doubt it can be improved.

    See later for updated attachment.
Posted on 2004-01-09 17:31:05 by adamjjackson
Why would anyone object? It's what it's all about, or isn't it? ;)

Anyways, nice work.. :alright:
Posted on 2004-01-09 20:34:10 by JimmyClif
Not sure why they would! Yep, that's what it's all about, hence I posted everything I did here :)
Posted on 2004-01-10 04:58:02 by adamjjackson
Hi. I forgot that I wanted to be able to resize the control. I've added this in now, see attachment for example.
Posted on 2004-01-10 07:12:46 by adamjjackson
Hello. I found a couple of bugs, the main one being that when the private data structure is created the memory is not zeroed. This creates problems when checking the empty linked list...
The fix is to replace :
invoke HeapAlloc,eax,NULL,SIZEOF CalControl ; Allocate Private Data. 
in the Do_create section with:
invoke HeapAlloc,eax,HEAP_ZERO_MEMORY,SIZEOF CalControl ; Allocate Private Data.

There were a couple of other things too. There's yet another upload with this post for anyone who's interested.
Posted on 2004-01-11 14:31:01 by adamjjackson
As I just got a request for the Calendar Control I thought I re-attach it here since it got deleted when we moved.
Posted on 2006-03-19 10:08:00 by JimmyClif
I think that it is VERY cool that some of you guys are taking the time to reattach the old gems as people such as myself missed these things.  I gotta love you.

Posted on 2006-04-19 16:58:23 by PBrennick